Price rule PURCHASE TYPE API

We are creating price rules using Shopify API, but there is no control of PURCHASE TYPE property for price rules, only for basic discount codes.

By default it’s “one time purchase”, but we need to be able to create and update prices using your API to set PURCHASE TYPE to both.

1 Like

Hey @sil2 I took a look at our docs and you are correct that there is not an option to control Purchase_Type for price rules. The solution that looks appropriate here might be https://shopify.dev/api/admin-graphql/2022-04/input-objects/DiscountCustomerGetsInput

If you have a use case for needing the purchase_type option in price rules please let us know, Id be happy to pass on feedback to our teams on your behalf.

Hope this helps. -K

I have a case where I need “purchase_type” to be available on the PriceRule Rest API:

I have a customer using a subscription product with my discount app and he can’t apply our discount in his order because the API do not allow me to change the “purchase_type” to “both”.

He simply switched the value to “both” in Shopify Admin and saved our discount, after that our discount can be applied in the order, the default value should be “both” (I don’t see why not), or the REST API should have the option to create the order with this attribute.

3 Likes

I have same issue exactly.

1 Like

We create price rules from our backend using Shopify GraphQL API. Because we can not set ‘Purchase_Type’ somebody needs to login into Shopify backend and change this parameter to ‘both’ manually every time. Sorry, but im not getting now ‘DiscountCustomerGetsInput’ can help.

any update on this issue? :slightly_smiling_face:

Finally found some guide here https://community.shopify.com/c/shopify-apis-and-sdks/discount-codes-for-one-time-purchases-and-subscriptions/m-p/1291376#M71373