I am looking to fetch draft products with the storefront api so I can continue to develop locally with draft products and not use an entirely different API just so I can work with draft products in my local development environment.
I have tried querying the status, only to fetch all active products.
Typically you’d use the Shopify Admin API to make requests to products and filter based on the status field, eg: GET /admin/api/2023-07/products.json?status=draft
If you really need to only use the Storefront API and want to simulate a “draft” environment, one workaround could be:
Use a specific tag (e.g., “draft_for_dev”) for products you consider as drafts.
Fetch products with this tag using the Storefront API.
Ensure that products with this tag are not visible to your real customers. You can do this by not publishing them to the sales channels or by using some theme logic to hide products with this tag.
However, this approach has its limitations, involves some manual work, and might not be suitable for all use cases. It’s a bit of a hack and is more of a workaround than a true solution, so I’d recommend using the Admin API to work with draft products.