Google Merchant Center

For arlanix/product-feed 1.0.0

Google Merchant Center

The Merchant API channel sends changed products directly to Google. For account setup and feed fields, see Google Merchant accounts.

Arlanix_GoogleMerchant owns accounts, credentials and data sources and works independently of ProductFeed. Arlanix_ProductFeed owns feed delivery and source registration. A source can belong to only one feed; deleting a feed leaves its account and source intact. Feed::getGmcAccountId() and Feed::getGmcDataSourceId() return its account and source references.

Manage data sources from code

Inject Arlanix\GoogleMerchant\Service\GmcDataSourceService to manage sources independently of ProductFeed:

Method What it does
refresh($accountId) Reads every page of Google's sources, updates local records and marks missing sources deleted only after a complete successful listing.
create($accountId, $wanted) Creates a remote source from GoogleApi\Dto\DataSourceInfo and records the identity returned by Google.
update($localId, $wanted) Updates the source's name and countries while preserving its remote identity and fixed label, language and kind.
delete($localId) Checks local deletion constraints before calling Google; an API failure rolls the local deletion back. A source already gone from Google can be removed locally.

Api\GmcDataSourceRepositoryInterface provides local persistence and lookup. Repository and management IDs are local datasource_id values; DataSourceInfo::dataSourceId is Google's ID, and resourceName is its complete accounts/.../dataSources/... name. ProductFeed's Service\FeedDataSourceService owns registration and binds sources to feeds through the feed resource. A replacement remote source gets its own local record, and the feed is linked to that record.

GmcDataSource::toDataSourceInfo() exposes the locally stored source fields as an API DTO, using Google's ID from the resource name. DataSourceInfo::needsUpdate() compares the writable display name and primary target countries, ignoring country order and case. Source rules are fetched from Google when linking.

Connect an account

The store owner makes the key and connects the account, with a screenshot a step, in the manual's Make the key and Connect the account. What it comes to:

  • A Google Cloud project with the Merchant API enabled.
  • A service account in that project, which needs no IAM roles, and its JSON key. The module reads the private key and client_email from it.
  • The key's client_email added to the Merchant Center account as a person with Admin access. The key alone opens nothing, and a user with less than Admin access cannot manage the account.

Saving an account that is not connected connects it: the module registers the key's Cloud project with Merchant Center, if that has not been done, then asks Google whether the key opens the account. Google applies a registration, and a client_email just added to the account, some seconds after accepting it and answers 401 or 403 until then, so the module asks again every few seconds for up to 15 seconds. When that is not enough, Connect tries again later.

Once Google opens the account, the module makes sure that the account's Developer email holds the API_DEVELOPER access right, through the Merchant API's accounts.users: it adds the right to that user's others, or creates the user with it, which Google sends an invitation for. Google requires a user with the right once the project is registered, and blocks the Merchant API 30 days after the last one is gone; see Google's registration FAQ (opens in a new tab). A test account is left alone, as Google grants the right only where a project is registered. Every save that connects, Connect and Test Connection check it again, and the module never takes a right away.

The service account needs Merchant Center access, the key must be valid, and Developer email must belong to a person's Google account. Client-facing connection messages and actions are in Troubleshooting.

A Cloud project is registered with one Merchant Center account. It can also connect a test account created under that account with the Merchant API's accounts.createTestAccount, provided its key has access. Google does not register the test account separately. Products sent to a test account are never shown on Google, and the account form's Test Connection says so.

The API channel

Set up the feed

The store sets up the feed in the admin: the manual's Point a feed at it has every field of the Channel section, what the save does with the data source, and how to change it later.

Saving an active feed creates or updates its data source. Registration failure leaves the feed saved; a later run retries registration. A source deleted in Merchant Center requires an explicit feed save to recreate it.

Save a primary feed before linking a supplemental source to it. Registered label, language and source kind are fixed for that Merchant ID. Changing accounts leaves the previous remote source intact.

Service\FeedDataSourceService owns registration and source lookup. activeSourceForFeed() excludes deleted sources; sourceForAccount() retains their state so delivery can require a save.

How the products then go to Google, and how the feed waits after a failure or a refused product, is in Merchant API feeds.

When Google refuses the account, or does not answer

Google takes one product per call. A delivery makes the calls of 25 products at once, and starts no more once its minute is up; the rest go the next minute.

What happens next depends on the problem:

Problem What happens
Google refuses what one product holds, such as an invalid GTIN That product is refused and offered again later. The others go on.
The module cannot convert a date or a yes/no field such as adult or identifier_exists The product is refused before sending. Boolean fields accept yes/no, true/false or 1/0.
The data source was deleted in Merchant Center The run stops, and the feed waits for a save: see the manual's When the data source is deleted in Merchant Center.
Every product would meet it: the key revoked or its client_email removed from the account, the quota spent, Google unavailable, or no answer at all The batch makes one attempt per product. The run stops, preserves successful answers, and leaves pending products for the feed's scheduled retry.

A date may be written 2026-10-01T00:00+0200, as Sale window gives it, 2026-10-01, 2026-10-01 13:00:00 or in RFC 3339. A date without an offset is read as UTC.

When a run stops, successful requests remain delivered. Products it did not reach stay pending for the next run. For the messages shown to the store team, see Troubleshooting.

The feed then waits before it is tried again, as after any failure: see When a run fails. Once you have fixed the cause, save the feed, and the next minute's delivery sends it.

Each call to Google has a limited time: by default 5 seconds to reach Google and 20 seconds for its answer. To change them, go to Stores → Configuration → Arlanix → Developer → Google Merchant Center API; see Settings.