CatalogUpdate¶
The CatalogUpdate push decides which company locations see a B2B catalog, and with it the catalog's price list. It can instead set the company locations a market applies to. Each record names one catalog or one market, and a list of company locations.
On a push connector, select CatalogUpdate as the Shopify Import Type. The push sends a catalog's changes through Shopify's catalogContextUpdate mutation and a market's through marketUpdate, 250 locations to a call. It needs a store with B2B. See Building a B2B Customer for where it fits.
The push creates no catalogs or markets. The Pricelist push creates a catalog with its price list. Create markets in the Shopify admin.
Catalogs and Markets¶
A market's conditions decide which buyers it applies to. A B2B market's conditions are company locations, and the market's settings, such as its catalogs and currency, apply to buyers who order for those locations.
A record names a market when MarketId or MarketName holds a value. IMan then sets the market's company locations and ignores CatalogId and CatalogName. A record with both market fields blank names a catalog. One run can mix catalog records and market records.
A company location can belong to several markets. Adding it to one market leaves it in the others, and IMan changes only the market a record names.
Fields¶
| Field | Rule |
|---|---|
CatalogId |
The catalog, as a numeric id or a gid. Written back when IMan finds the catalog by name |
CatalogName |
With CatalogId blank, the title of the catalog. A record whose catalog IMan cannot find fails |
MarketId |
The market, as a numeric id or a gid. Takes precedence over MarketName. IMan writes back the market's gid |
MarketName |
With MarketId blank, the name of the market. The name must match exactly, but IMan ignores case. A record whose market IMan cannot find fails |
CompanyLocationIDs |
The company locations, as numeric ids or gids, separated by |. Company Locations writes back each location's id |
| Use Bulk Operations | True sends the run through bulk operations |
Update Operations¶
The Designer offers two:
| Update Operation | Effect on the catalog's or market's company locations |
|---|---|
| Insert | Adds the listed locations the catalog or market does not have. Removes none. A record for each location works, because records do not interfere |
| Synchronise | Makes the locations exactly the list: adds the missing ones, then removes the rest. When several records name one catalog or market, the last record's list wins |
A blank list under Synchronise removes every location from a catalog
Under Synchronise, a catalog record with a blank CompanyLocationIDs removes every company location from its catalog. Filter out records with no locations before the writer.
A market record with a blank list under Synchronise fails instead, and IMan leaves the market as it is. Under Insert, a blank list changes nothing.
A job saved with Update or Insert/Update adds locations, as Insert does.
Errors¶
IMan reads the catalog's or market's current locations before it changes them, and sends only the changes.
A market record fails before IMan sends anything when:
- IMan cannot find the market by its id or name.
- The market applies to all company locations.
- The update operation is Synchronise and
CompanyLocationIDsis blank.
A market whose conditions are regions takes no company locations. Shopify refuses the call, and the record fails with Shopify's message.
Shopify treats each catalog call as a whole:
- A location Shopify refuses, such as one it cannot find, fails alone. IMan sends the rest of its call again.
- A location the catalog already has counts as done.
- An error that names no location fails the whole call.
Shopify applies a market call whole or not at all:
- When Shopify cannot find some of the call's locations, IMan checks the call's locations against the store. It fails those the store does not have and sends the others again.
- Any other refusal fails the whole call.
A failed call does not stop the record. IMan sends its other calls, then fails the record with one message that lists each failure. The locations Shopify accepted stay assigned.
Shopify sometimes refuses a change while another change to the same catalog or market is under way. IMan then waits and sends the call again: after 10, 30, 60, 120 and 240 seconds. If Shopify still refuses it, the call fails.
Bulk Operations¶
With Use Bulk Operations on, IMan holds the records, reads each named catalog or market and its locations once with normal requests, then sends the changes as Shopify bulk operations. Under Synchronise, records that name the same catalog or market go in successive rounds, and the last record wins. Each round sends the adds, then the removals. IMan sends the market changes after the catalog changes.
A record that would fail before IMan sends anything on a normal run, such as one that names a market IMan cannot find, fails the same way in a bulk run. IMan handles Shopify's refusals as on a normal run, and sends the locations that go again in a further operation.
Access Scopes¶
The push needs write_products. Records that name a market also need read_markets and write_markets, and read_companies to read the market's company locations. See Access Scopes.
Without the market scopes, a market record fails with a message that begins:
On a store where the app is already installed, the store owner approves the new scopes before IMan can use them. See Adding Scopes Later.
Shopify Reference¶
catalogContextUpdate and marketUpdate in Shopify's GraphQL Admin API reference.