Skip to content

Sales channels

A sales channel is somewhere a store's products are sold or advertised: the store's own shop, or a plugin such as a shopping feed. A plugin that declares itself a channel gets a switch on every product, so a merchant can leave a product out of that channel without deleting it. This guide covers declaring the channel, honouring the switch in your feed, and changing channels from your plugin.

What a sales channel is

Every store has these channels:

  • online_store: the store's own shop. A merchant can switch a product off it, for example to sell it only on a marketplace. The shop shows a product only while it is active and on the online store.
  • One channel per active plugin that declares salesChannel, keyed by the plugin id.

New products start on every channel. A merchant can switch a product off for a plugin channel from the Sales channels card on the product page, and from the products list, which shows a channel column and filters and offers bulk include and exclude.

Declare your channel

Add a top-level salesChannel to plugin.json:

JSON
{
  "salesChannel": {
    "name": "Google Shopping",
    "icon": "https://cdn.example.com/google-shopping.png"
  }
}

name is 1 to 60 characters and is what merchants see on the product page. Declaring it says your plugin sells or advertises the store's products, for example a shopping feed or a marketplace. null or absent means the plugin is not a channel. Like the rest of the configuration, changing it needs a new release.

icon is optional. Merchants see it beside the channel name. Without it they see your plugin's icon, so set one only when the channel's brand differs from your plugin's, for example a connector to a marketplace you do not run. Use an absolute https URL of a square PNG, JPG, SVG or WebP image; staging and production releases refuse http and localhost.

In the partner dashboard, the Sales channel section on your plugin's Technical tab sets both, uploads the icon for you, and previews the row merchants will see. Save and release to apply it.

Honour the switch in your feed

GET /v1/products/sync gives every product an excludedChannels array: the channel keys the merchant left it out of, sorted, and [] when it is on every channel. A feed must leave out a product when its list holds your plugin id or "online_store", since every shopping feed sends shoppers to the shop. A marketplace that never links to the shop checks only its own id: a product the merchant keeps off the shop may be exactly the one they sell there.

TypeScript
const MY_PLUGIN_ID = "orbit-google-merchant-feed";

const feedProducts = products.filter(
  (product) =>
    !(
      product.excludedChannels?.includes(MY_PLUGIN_ID) ||
      product.excludedChannels?.includes("online_store")
    ),
);

Products synced before the field existed carry nothing, so a missing field means [], which is what the optional chaining above already does.

Let merchants change it from your plugin

POST /v1/sales-channels/own changes your own channel, with scope product:update. It is for plugin tokens only: an API key gets 403. The channel is always the calling plugin, so it cannot touch another channel or store, and product data never changes. A store keeps your previous release until the merchant approves a newly requested scope, so treat a 403 as "not approved yet" and try again later.

HTTP
POST /v1/sales-channels/own HTTP/1.1
Host: api.myorbitcommerce.net
Authorization: Bearer <access-token>
Content-Type: application/json

{
  "productIds": [
    "0f3c8b2a-1d4e-4a6b-9c2f-7e5a1b2c3d4e",
    "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
  ],
  "available": false
}
FieldPurpose
productIds1 to 1,000 product ids.
availabletrue to put the products on your channel, false to leave them out.

A plugin without salesChannel gets 400. The answer is { count, matched }: how many products changed, and how many ids were sent. Ids of other stores and deleted products are skipped.

Read the store's channels

GET /v1/sales-channels lists the store's channels, with scope product:list. The online store comes first.

FieldPurpose
keyThe channel key: "online_store" or a plugin id.
nameThe name merchants see.
kind"online_store" or "plugin".
iconAn image URL: the channel's own icon when its manifest declares one, else the plugin's icon. null for the online store.

The answer is { items: [{ key, name, kind, icon }] }.

Change any channel

POST /v1/sales-channels/bulk changes a channel by key, with scope product:update. It is for any plugin channel, including CSV imports and ERP sync.

HTTP
POST /v1/sales-channels/bulk HTTP/1.1
Host: api.myorbitcommerce.net
Authorization: Bearer <access-token>
Content-Type: application/json

{
  "productIds": [
    "0f3c8b2a-1d4e-4a6b-9c2f-7e5a1b2c3d4e",
    "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
  ],
  "channelKey": "orbit-google-merchant-feed",
  "available": true
}

The body takes 1 to 1,000 product ids and answers { count, matched } in the same way. "online_store" takes the products off the store's own shop (available: false) or puts them back; an unknown key is refused with 400.

Method and pathScopePurpose
GET /v1/sales-channelsproduct:listList the store's channels.
POST /v1/sales-channels/ownproduct:updateChange your own channel.
POST /v1/sales-channels/bulkproduct:updateChange any plugin channel.

Stay in step

A change on one product's card arrives as product.updated with changedFields: ["salesChannels"]. Re-read that product with GET /v1/products/{id}, which carries excludedChannels too.

Every bulk product change arrives once as product.bulk_updated (scope product:read): the bulk editor, bulk status changes and deletes, and bulk sales channel changes. Its payload is { storeId, count, changedFields, productIds? }, where productIds is present when 1,000 or fewer. Re-read the products it names, or the whole catalogue with GET /v1/products/sync when it names none, rather than expecting a delivery per product.

A sales channel change does not change a product's updatedAt, so an incremental read with updatedFrom does not see it. When changedFields holds "salesChannels", re-read the products themselves.

Next steps

  • Webhooks: subscribe to product changes and verify the deliveries.
  • Publishing: declare the channel in your manifest and ship it in a release.