Discussing APIs and development related to customers, discounts, and order management.
I currently have added a price rule to shopify via the post method.
const title = body.get("title");
const price_rule = new admin.rest.resources.PriceRule({session: session});
price_rule.title = title;
price_rule.value_type = "fixed_amount";
price_rule.value = "-10";
price_rule.customer_selection = "all";
price_rule.target_type ="line_item";
price_rule.target_selection = "entitled";
price_rule.allocation_method = "each";
price_rule.starts_at = "2018-03-22T00:00:00-00:00";
price_rule.entitled_product_ids = [
6952008155224
];
price_rule.prerequisite_quantity_range = {
"greater_than_or_equal_to": 2,
}
price_rule.allocation_limit = 3;
await price_rule.save({
update: true,
});
My expectation is that when I add the product 6952008155224 with greater or equal to quantity 2. That each item would deduct 10. Meaning if product is 30 it would -10 and give each one at 20. However I don't see anything in the cart or the checkout regarding the discount.
The post went in successful but it's not executing. Any idea if i'm missing something?