Error on product sync after updating to PHP 8.3
-
Here’s the error:
PHP Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, WP_Error given in /wp-content/plugins/facebook-for-woocommerce/includes/ProductSets/Sync.php:240
In this code:public function maybe_sync_product_sets( $product_cats, $product_sets ) {
if ( empty( $product_sets ) || ! is_array( $product_sets ) ) {
$product_sets = array();
}
$product_set_term_ids = array_merge( array(), $product_sets );
// check if product cat belongs to a product_set
foreach ( $product_cats as $product_cat_id ) {
$cat_product_sets = $this->get_product_cat_sets( $product_cat_id );
if ( ! empty( $cat_product_sets ) ) {
$product_set_term_ids = array_merge( $product_set_term_ids, $cat_product_sets );
}
}
foreach ( $product_set_term_ids as $product_set_id ) {
$this->maybe_sync_product_set( $product_set_id );
}
}Fixed it like this:
if ( ! is_wp_error( $cat_product_sets ) && is_array( $cat_product_sets ) ) { $product_set_term_ids = array_merge( $product_set_term_ids, $cat_product_sets ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Error on product sync after updating to PHP 8.3’ is closed to new replies.