Update to check if the return of get_post_meta is an array

This commit is contained in:
Ramon 2022-04-03 19:46:12 -03:00
parent 1141984c2d
commit e6d412093a
1 changed files with 1 additions and 1 deletions

View File

@ -686,7 +686,7 @@ function wc_get_product_id_by_sku( $sku ) {
*/ */
function wc_get_product_variation_attributes( $variation_id ) { function wc_get_product_variation_attributes( $variation_id ) {
// Build variation data from meta. // Build variation data from meta.
$all_meta = array_filter( (array) get_post_meta( $variation_id ) ); $all_meta = is_array( get_post_meta( $variation_id ) ) ? get_post_meta( $variation_id ) : array();
$parent_id = wp_get_post_parent_id( $variation_id ); $parent_id = wp_get_post_parent_id( $variation_id );
$parent_attributes = array_filter( (array) get_post_meta( $parent_id, '_product_attributes', true ) ); $parent_attributes = array_filter( (array) get_post_meta( $parent_id, '_product_attributes', true ) );
$found_parent_attributes = array(); $found_parent_attributes = array();