• Resolved mazursv

    (@mazursv)


    I found this error in log. Look like you send an array instead of comma separated list of urls.

    2021-11-04T15:27:55+00:00 ERROR Automattic\WooCommerce\GoogleListingsAndAds\Product\ProductSyncer::update_by_batch_requests {
      "error": {
        "code": 400,
        "message": "Invalid value at 'body.entries[0].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[1].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[2].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[3].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[4].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[5].product' (additional_image_links), Starting an object on a scalar field",
        "errors": [
          {
            "message": "Invalid value at 'body.entries[0].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[1].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[2].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[3].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[4].product' (additional_image_links), Starting an object on a scalar field\nInvalid value at 'body.entries[5].product' (additional_image_links), Starting an object on a scalar field",
            "reason": "invalid"
          }
        ],
        "status": "INVALID_ARGUMENT"
      }
    }
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter mazursv

    (@mazursv)

    Hi! Products that have multiple images are not synced to merchant center. Any chance you can check this asap?

    Hi @mazursv,

    I understand that the products on your website that have multiple images are not being synced to Google Merchant Center and you shared an error from your log which seems to be related to the issue you’re having.

    Could you please send me a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, you can paste it here in your reply.

    Thread Starter mazursv

    (@mazursv)

    Hi @nagdy,

    Not sure why do you need our System Status report. It’s clear that there is problem with data that you send to merchant api. Please check following link
    https://support.google.com/merchants/answer/6324370

    Plugin Support B C. a11n

    (@battouly)

    Hi @mazursv,

    We need the system status report to understand more system environment. Please share it with us.

    It will be great if you could share your current System Status Report. You can get it by navigating to the WooCommerce / Status section of your site. Once there, click on the Get system report button and then copy it by clicking on the Copy for support button. Then paste it here in a comment.

    Looking forward to reading from you!

    Thread Starter mazursv

    (@mazursv)

    Hi!

    Following code resolves the problem:

    
    function fix_additional_image_links( $values, $wc_product, $wc_product_adapter ) {
        $additional_image_links = $wc_product_adapter->getAdditionalImageLinks();
    
        if( is_array( $additional_image_links ) ) {
            $values['additionalImageLinks'] = implode(',', array_map( static function( $x ) {
                return str_replace(',', '%2C', $x );
            }, $additional_image_links ) );
        }
    
        return $values;
    }
    
    add_filter('woocommerce_gla_product_attribute_values', 'fix_additional_image_links', 10, 3);
    
    

    Also need to change additionalImageLinks validation in WCProductAdapter class to following:

    
    $metadata->addPropertyConstraint( 'additionalImageLinks', new Assert\Length( null, 0, 2000 ) );
    

    After applying these changes our products start syncing properly.

    • This reply was modified 3 years, 4 months ago by mazursv.
    • This reply was modified 3 years, 4 months ago by mazursv.
    mother.of.code

    (@imazed)

    The Mother of Code

    Thank you for that @mazursv! I’ll go ahead and mark this topic as resolved. Please get back in touch if you have any other questions!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Invalid value additional_image_links’ is closed to new replies.