Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Query unpublished products

Solved

Query unpublished products

Luis_Martins
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?

Accepted Solution (1)

KarlOffenberger
Shopify Partner
1873 184 902

This is an accepted solution.

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!

View solution in original post

Replies 3 (3)

KarlOffenberger
Shopify Partner
1873 184 902

This is an accepted solution.

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!

Luis_Martins
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.

meatball92
Visitor
1 0 0

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