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.

api price_rules combinesWith

api price_rules combinesWith

YanaDot
Shopify Partner
4 0 0

Good afternoon!
I have a question about "https://shopify.dev/docs/api/admin-rest/2024-01/resources/pricerule"

YanaDot_0-1718808014234.png

How do I configure "Combinations" (on the screenshot) for discounts that I create via api/admin-rest pricerule
I can't find it in the documentation.
Here is an example of the code for creating a discount via pricerule:
$addPriceRule = $api->rest('POST','/admin/api/2024-01/price_rules.json', [
"price_rule" => [
"title" => $request['priceId'],
"target_type" => "line_item",
"target_selection" => "all",
"allocation_method" => "across",
"once_per_customer" => true,
"value_type" => "fixed_amount",
"value" => -intval($request['reward']),
"customer_selection" => "all",
"starts_at" => "2022-10-21T17:59:10Z"
]
]);

 

What should be added to change the fields (Product discounts, Order discounts, Shipping discounts) in the new discount?
I currently need to activate "Order discounts" so that I can use several vouchers in one order.

 

Best regards

Reply 1 (1)

Alexey_Kardo
Shopify Partner
4 0 0

I have the same problem.
I create two discounts - for products and for shipping. I need to make them work together.

But I didn't find any information in the documentation how to do this.