0

I am working with Drupal Commerce.

How I could edit the Unit Price of all Commerce Line Items to $200 when "Add a Product to Cart" Event is fired. !

1

this rule update unit price Unit Price of all Commerce Line Items to $200 when "Add a Product to Cart" Event is fired.

{ "rules_set_unit_price" : {
"LABEL" : "Set Unit Price",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_cart" ],
"ON" : { "commerce_cart_product_add" : [] },
"DO" : [
  { "data_set" : {
      "data" : [ "commerce-line-item:commerce-unit-price" ],
      "value" : { "value" : { "amount" : 20000, "currency_code" : "USD" } }
    }
   }
  ]
 }
}
0

I already tried this , and it works fine for me , Thanks for your answers.

{ "rules_calp8" : {
"LABEL" : "Set Unit Price",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [
  "commerce_cart",
  "rules",
  "commerce_line_item",
  "commerce_product_reference"
],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
  { "commerce_order_is_cart" : { "commerce_order" : [ "commerce-line-item:order" ] } },
  { "data_is" : { "data" : [ "commerce-line-item:order:uid" ], "value" : "1" } }
],
"DO" : [
  { "commerce_line_item_unit_price_amount" : {
      "commerce_line_item" : [ "commerce_line_item" ],
      "amount" : "20000.00",
      "component_name" : "base_price",
      "round_mode" : "1"
    }
  }
]

} }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.