1

For a project I have to automate the updating process for products in the Google Merchant Center. These products have been added through a feed with a Google Sheet as the input method. This is the "primary feed".

Based on the documentation of the v2.1 api, updating products that have been added through the primary feed can be done with a supplemental feed (see: https://developers.google.com/shopping-content/guides/products/supplemental-feeds/using-supplemental-feeds). This supplemental feed allows only a subset of the product attributes to be updated.

Using the feed ID of the supplemental feed, I made single product insertions work. However, because of the api http request limits and the huge amount of products to be updated, I need to use the batch method. Unfortunately, I can't seem to get it working.

TL;DR Inserting a single product works, inserting a product with the custombatch method does not work. Response of the batch method seems OK, but it has no affect at the Google Merchant Center dashboard.

Implementation

Service:

service = build('content', 'v2.1', credentials=scoped_credentials)

Updating a single product through my supplemental feed works with the following code.

/*
product = {'title': 'Single update 12-42', 'price': {'value': '69', 'currency': 'EUR'}, 'offerId': 'abcd1', 'contentLanguage': 'en', 'targetCountry': 'NL', 'channel': 'online', 'availability': 'out of stock'}
*/
result = service.products().insert(merchantId=MERCHANT_ID, body=product, feedId=FEED_ID).execute()
/*
result = {'kind': 'content#product', 'id': 'online:en:NL:abcd1', 'offerId': 'abcd1', 'contentLanguage': 'en', 'targetCountry': 'NL', 'channel': 'online'}
*/

Yet, doing an update through a batch request has no effect.

/*
body = {'entries': [{'batchId': 1, 'merchantId': MERCHANT_ID, 'method': 'insert', 'feedId': FEED_ID, 'product': {'title': 'Batch update 12-44', 'price': {'value': '69', 'currency': 'EUR'}, 'offerId': 'abcd2', 'contentLanguage': 'en', 'targetCountry': 'NL', 'channel': 'online', 'availability': 'out of stock'}}]}
*/
result = service.products().custombatch(body=body).execute()
/*
result = {'kind': 'content#productsCustomBatchResponse', 'entries': [{'kind': 'content#productsCustomBatchResponseEntry', 'batchId': 1, 'product': {'kind': 'content#product', 'id': 'online:en:NL:abcd2', 'offerId': 'abcd2', 'contentLanguage': 'en', 'targetCountry': 'NL', 'channel': 'online'}}]}
*/

Remarkably, I do receive a valid response without any errors. Yet there is no effect in the merchant center dashboard with the batch method (there is with the single insert).

Does anyone else encounter the same problem, or am I missing something?

1 Answers1

1

I ran through the same issue when integrated the Node client library. After some research I found answer to this issue on GitHub.

You need to add a 'resource' field that contains 'entries' since they're sent as part of the body. You can refer the GitHub issue here.

Change the body in your code to:

body = {'resource': {'entries': [{'batchId': 1, 'merchantId': MERCHANT_ID, 'method': 'insert', 'feedId': FEED_ID, 'product': {'title': 'Batch update 12-44', 'price': {'value': '69', 'currency': 'EUR'}, 'offerId': 'abcd2', 'contentLanguage': 'en', 'targetCountry': 'NL', 'channel': 'online', 'availability': 'out of stock'}}]}}
Girish Vadhel
  • 735
  • 1
  • 5
  • 17