Filter by Subscription Products Using Product JSON

PaulVomberg
Tourist
13 0 0

Shopify provides options for selling a product as a subscription within the admin - instructions here:  https://help.shopify.com/en/manual/products/subscriptions/setup#subscription-products 

Specifically: Select whether to sell the product as a subscription only:

  • To sell the product as a subscription only, check Sell product as a subscription only.
  • To sell the product as one-time purchases as well as subscriptions, uncheck Sell product as a subscription only.

Once this box is checked or unchecked, when taking a look at the product JSON there is no identifier for if this box is checked or not. 

What's the best way for an application to see if this box is checked or unchecked if this selection does not appear in the product JSON? 

Feels like it would be helpful if on the product JSON something such as this appears: "subscription_only: true" or  "subscription_only: false". 

 

Reply 1 (1)
otroyos
Shopify Staff
8 0 2

Hi PaulVomberg,

Certainly! You can use Product.requiresSellingPlan from the Admin API or the Storefront API to find whether or not a product is subscription only.

I hope this is useful.

Best,

Juan