Sales Channel Identification via Products Api

Highlighted
New Member
1 0 0

Hi all,

I am trying to determine products sales channel via Products admin api.

As per docs, it could be known by looking at 'published_scope' field in json data.

I have discovered following API behaviour.

Sales channel           ----> published_scope

Online Store,POS              global

Online Store                       web

POS                                      global

empty                                 web

My problem is that, i want to filter only those products which have either online store as one of its sales channel or haven't have any sales channel selected.(Case 1,2,4 in above example should be final output)

Please suggest the way to achieve desired behaviour.

Thanks in advance

0 Likes
Shopify Staff
Shopify Staff
998 66 130

Hello @rohit-bitqit , 

 

In doing some testing, I've noticed that if a product has not been published to any channels at all, it will have a 'null' published_at value - so you should be able to use that field to tell if a product doesn't have any channels selected even though there will still be a 'web' published_scope. 

 

And then if you find a product with a published_scope of 'web' and a published_at value that is not 'null' that would indicate the product was listed on the online store sales channel. Otherwise, it appears that a combination of online store and any other sales channel would result in a published_scope of 'global'

 

Hope this helps! 

0 Likes