Query unpublished products

Solved
Shopify Partner
9 0 0

Hi,

 

I'm trying to figure out what would be best approach to query products that are unpublished.

The use case is to build an "upcoming" products launch page, where I list the upcoming product, but having those products unpublished until the launch date set in Product Availability settings.

 

What options do I have in Shopify for such scenario?

0 Likes

Success.

Shopify Partner
1838 173 601

Hi Luis,

 

The problem with products in unpublished state is exactly that - they're unpublished and hence you won't be able to access these products in your Liquid template code when creating the "upcoming" page.

 

You could work around that by creating an app that queries the Admin API and provides that data back to the storefront and Liquid via an app proxy.

 

But a much simpler way would be to use either tags or metafields to denote the "unpublished" or "coming soon"state in conjunction with an inventory level set to 0 and inventory policy deny.

 

Hope this helps!

I turn coffee in to code - since 1998
1 Like
Shopify Partner
9 0 0

Hi Karl, thanks so much for your suggestion.

I think I will need to go with the app route in that case. Tags was something I've quickly had to rule out, because we would loose the ability to schedule the products to switch state programatically. That is, right now they go live on a schedule based on the publish settings we set in Shopify. Going with tags, we would have to manually edit each product at that time to remove the tags, and that won't be quite feasible since there will be quite a few products.

 

I'll give it a try with a custom app. 

Thanks again for your feedback.

0 Likes
Highlighted
New Member
1 0 0

Hi Luis, I've run into the same problem, and wondering if you've had any success with this?

0 Likes