Shopify's uncooperativeness is really holding back development for one of my apps because of such a small part of it. Since Shopify isn't helping, for now, I'm just using the bulk editor and it's bulk select feature by holding Shift and selecting the first and last product. If you have a lot (I'm talking thousands) of products selected and need to edit their sales channels, use the following Tampermonkey userscript on each of the pages:
// ==UserScript==
// @name Adding All Sales Channels
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Make all selected products visible on all selected sales channels. (Shopify)
// @author You
// @match https://[SHOP NAME].myshopify.com/admin/bulk
// @require http://code.jquery.com/jquery-3.3.1.comp.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
$('.next-checkbox').each(this.attr('checked','checked'));
})();
Make sure to keep the script disabled by default and to change "[SHOP NAME]" to the URL bit of your shop name.
It's still extremely annoying, though, and I'd love it if they would add the ability to manage sales channels from the API itself.
I'm also very much in need of this functionality. It looks like the GraphQL API has a mutation that can supposedly publish products on specific sales channels: https://help.shopify.com/api/graphql-admin-api/reference/mutation/publishablepublish.
The problem is, it requires the 'write_channels' access scope, which doesn't seem to exist! I can't seem to get write_channels permissions on either a public or private app. I've started a new thread asking specifically about the write_channels permission: https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/write_channels-525389 but no reply yet.
Almost three years, very disappointing indeed.
Nigel's post is probably the path to do this. In previous situations (order messages/comments, order conversion details) I've found that GraphQL has support for much more operations and data retrieval. It's however really undocumented (e.g. supported query parameters) so it's a bit of trial-and-error.
I have <100 products so I'm not gonna bother researching GraphQL for this.
Did some quick research in case it's helpful for anyone:
https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/productupdate#arguments
States: "productPublications ([ProductPublicationInput!])
A list of the channels where the product is published. This argument is deprecated: Use PublishablePublish instead."
https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/publishablepublish
Then
https://help.shopify.com/en/api/graphql-admin-api/reference/input_object/publicationinput
Suggests you need a channelId.
I'd think you get the channelId from this:
https://help.shopify.com/en/api/graphql-admin-api/reference/object/product
Which returns this:
https://help.shopify.com/en/api/graphql-admin-api/reference/object/channel
User | Count |
---|---|
28 | |
7 | |
7 | |
6 | |
4 |