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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

[PriceRule] How to create Buy X, Get y and setting the minimum purchase amount via GQL?

Solved

[PriceRule] How to create Buy X, Get y and setting the minimum purchase amount via GQL?

supportmay
Shopify Partner
1 0 0

Hello,

I'm trying to create a PriceRule via GQL. I found the relevant documentation at: https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/priceRuleCreate.

 

But I didn't find a description in the documentation of creating Buy X, Get Y and setting the minimum purchase amount.

 

I found the description of creating Buy X, Get Y and setting the minimum purchase quantity, prerequisiteToEntitlementQuantityRatio and it works fine.

 

I tried to use prerequisiteToEntitlementAmountRatio, but it prompted me that Field is not defined on PriceRuleInput.

Accepted Solution (1)

Yashas
Shopify Partner
5 1 1

This is an accepted solution.

Hey @supportmay ,

 

I just found that there is now a dedicated gql mutation to create a buy x get y discount which support the minimum purchase amount. Please check this link: https://shopify.dev/docs/api/admin-graphql/2024-07/mutations/discountCodeBxgyCreate

View solution in original post

Reply 1 (1)

Yashas
Shopify Partner
5 1 1

This is an accepted solution.

Hey @supportmay ,

 

I just found that there is now a dedicated gql mutation to create a buy x get y discount which support the minimum purchase amount. Please check this link: https://shopify.dev/docs/api/admin-graphql/2024-07/mutations/discountCodeBxgyCreate