Pricerule created but product doesn't get discount

Solved
Highlighted
New Member
3 0 0

I'm need to create some rules. So started with the most basic from the sample

{
  "price_rule": {
    "title": "SUMMERSALE10DOFF",
    "target_type": "line_item",
    "target_selection": "all",
    "allocation_method": "across",
    "value_type": "fixed_amount",
    "value": "-10.0",
    "customer_selection": "all",
    "starts_at": "2020-05-04T01:05:10Z"
  }
}

I get a success return

{
    "price_rule": {
        "id": 642888269926,
        "value_type": "fixed_amount",
        "value": "-10.0",
        "customer_selection": "all",
        "target_type": "line_item",
        "target_selection": "all",
        "allocation_method": "across",
        "allocation_limit": null,
        "once_per_customer": false,
        "usage_limit": null,
        "starts_at": "2020-05-03T21:05:10-04:00",
        "ends_at": null,
        "created_at": "2020-05-04T01:03:24-04:00",
        "updated_at": "2020-05-04T01:03:24-04:00",
        "entitled_product_ids": [],
        "entitled_variant_ids": [],
        "entitled_collection_ids": [],
        "entitled_country_ids": [],
        "prerequisite_product_ids": [],
        "prerequisite_variant_ids": [],
        "prerequisite_collection_ids": [],
        "prerequisite_saved_search_ids": [],
        "prerequisite_customer_ids": [],
        "prerequisite_subtotal_range": null,
        "prerequisite_quantity_range": null,
        "prerequisite_shipping_price_range": null,
        "prerequisite_to_entitlement_quantity_ratio": {
            "prerequisite_quantity": null,
            "entitled_quantity": null
        },
        "title": "SUMMERSALE10DOFF",
        "admin_graphql_api_id": "gid://shopify/PriceRule/642888269926"
    }
}

But when I view the product the price is without discount. I've added it into the cart also same. Without any discount. I've tried the shop 5 minutes after 2020-05-04T01:05:10Z.

 

Appreciate any pointers where did I go wrong. Any additional settings needed.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
619 76 139

This is an accepted solution.

Hey @willbeh,

 

A priceRule is used to create the pricing logic/rules for a discountCode. After a price rule is created, you need to associate that rule to a discount code, and a customer will need to use that code at checkout to get the discount.

 

If you're looking to create automatic discounts that get applied to a cart without the need for a discount code, you can use the GraphQL API. This tutorial shows 2 examples of GraphQL mutations that can accomplish this.

 

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
New Member
3 0 0

Thanks for the reply. I will try it out.

0 Likes
Highlighted
New Member
3 0 0

Can I create multiple automatic discount be set to selected customer search saved?

0 Likes