Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
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?
Solved! Go to the solution
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!
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!
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.
Hi Luis, I've run into the same problem, and wondering if you've had any success with this?