• Resolved kriztjan

    (@kriztjan)


    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)
  • Hey there, @kriztjan! Thanks for contacting us.

    As I understand you were able to fix the issue with the custom code, correct?
    Thank you for sharing the solution here and contributing to the WooCommerce Community. This might help other users in the future.

    Having said that, we’d love to take a look at the issue. Do you mind sharing more details about it with us?

    You mentioned you got this error when trying to sync products after updating to PHP 8.3, correct?

    Did it happened with all products, or only some?
    Did it happened when you were trying to sync new products or updating existing ones?
    Did you see this error on your dashboard or on the error logs?
    Were there more Facebook related or Fata errors on the error logs?
    Do you mind sharing the System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support so we can take a look?

    Looking forward to your reply.

    Have a wonderful day!

    anastas10s

    (@anastas10s)

    Hi! I’m marking this topic as “resolved” due to recent inactivity. If more assistance is needed, feel free to post back here or?open a new topic.

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.