Discussions

How to set the unit price to a specific amount of a specific product

In Drupal Commerce Kickstart 7.x-2.3

How would I "set the unit price to a specific amount" for ONLY ONE specific product? I get how to "set the unit price to a specific amount" in the pricing rules BUT the price for all line items change to the amount per product. Not what I want.

I want product 1 to stay at $10/each but if you order more than 1,000 of product 2 I want the price of only product 2 to change from .13¢ to .12¢ - what is happening is all line items are changing to .12¢ when the quantity gets above 1,000. So product 1 and product 2 are both changing to .12¢.

Product 1 should remain at $10/each and only product 2 should change from .13¢ to .12¢

I attached an screen grab of how I have the pricing rule set up. I hope someone can help me out here, thank you ahead of time.

AttachmentSize
Image icon pricing-rule.jpg95.15 KB
Posted: May 2, 2013

Comments

maciej.zgadzaj on May 3, 2013

Hm, it seems that your problem lies in conditions. Total product quantity comparison works on all products in the shopping cart, not only one selected in Order contains a particular product rule.

Note that Order contains a particular product rule allows you to specify amounts too, which seems to be a better solution here.

For example this works fine and changes the price of only one product:

{ "rules_wallet_cards" : {
    "LABEL" : "wallet cards",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_order", "commerce_line_item", "commerce_product_reference" ],
    "ON" : [ "commerce_product_calculate_sell_price" ],
    "IF" : [
      { "commerce_order_contains_product" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "product_id" : "WC-Alabama",
          "operator" : "\u003E=",
          "value" : "1000"
        }
      }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_amount" : {
          "commerce_line_item" : [ "commerce-line-item" ],
          "amount" : "12",
          "component_name" : "base_price",
          "round_mode" : "1"
        }
      }
    ]
  }
}

owl on May 9, 2013

I imported your rule and the same thing is happening, once WC-Alabama reach 1,000 all products in the cart prices change to .12

And by the way, I really don't want just that SKU to get a price reduction, I'd like all wallet cards to get a price reduction. Help help help : )