How to automatically hide a product?

bradypt
Shopify Partner
9 0 0

Hi guys,
My app uses a product to represent a value-added item that customers can choose to purchase as part of their basket by clicking a button on the cart page.  I really need the product to be invisible on the store's catalogue pages, not appear in retargeting emails nor be sucked into the merchant's warehousing system. I need to hide the product but for it still to be buyable.

I've manually hidden the product using collection filters for some merchants but this is not a viable solution as the app scales. I need the product to be automatically hidden as soon as the app is installed. 

Does anyone have ideas as to how this might be done? 

 

Any help greatly appreciated.

0 Likes
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
623 102 136

Hi @bradypt ,

 

Yes this is possible. Using the Product resource from the Shopify Admin API (REST documentation:https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-04), you can set the field of "published_at" to be 'null' on the product. This will unpublish/remove all instances of your product from your Shopify Online Store, but will still keep your product available in the Admin. 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
policenauts
Trailblazer
160 7 25

@hassain this makes it available in Shopify Admin, but is actually not purchasable online (I get an out of stock error). From all the other threads I've read it seems the only way is manipulating collection visibility somehow - is that correct?

0 Likes