Merge pull request #27441 from Rahmon/patch-1
Ensure that the return of get_the_terms is not a WP error
This commit is contained in:
commit
bdb1451f2b
|
@ -1708,7 +1708,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
$product_type = 'variation';
|
||||
} elseif ( 'product' === $post_type ) {
|
||||
$terms = get_the_terms( $product_id, 'product_type' );
|
||||
$product_type = ! empty( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple';
|
||||
$product_type = ! empty( $terms ) && ! is_wp_error( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple';
|
||||
} else {
|
||||
$product_type = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue