1

I'm using Commerce Kickstart and I am trying to create a pricing rule for a custom line item that references a taxonomy term that adds an amount to the product's base price.

For the condition, I have chosen "Line item product has term(s)" (I believe that is made available from the commerce rules extra module). My question is what Data selector should be chosen?

I can get it to work if I chose the condition of "entity has field" and then select the field that references the taxonomy. The problem is, if nothing is selected in the field by the user - the amount is added anyway as this condition just checks for a field

Here is the rule:

{ "rules_wingstop_plano_tx_options" : { "LABEL" : "Wingstop Plano TX Options", "PLUGIN" : "reaction rule", "OWNER" : "rules", "TAGS" : [ "Plano TX", "Wingstop" ], "REQUIRES" : [ "rules", "commerce_rules_extra", "commerce_line_item", "commerce_product_reference" ], "ON" : { "commerce_product_calculate_sell_price" : [] }, "IF" : [ { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "field_quantity" } }, { "AND" : [ { "commerce_rules_extra_rules_condition_has_terms" : { "line_item" : [ "commerce-line-item:order:commerce-line-items:0" ], "voc_name" : "wingstop_plano_tx_75074_boneless_wing_options", "term_id" : { "value" : { "73" : "73" } }, "product_display" : "1", "term_operator" : "IOO" } } ] } ], "DO" : [ { "commerce_line_item_unit_price_add" : { "commerce_line_item" : [ "commerce_line_item" ], "amount" : "300", "component_name" : "base_price", "round_mode" : "0" } } ] } }

Thanks in advance to any insight you can give on this.

Scott

  • Did you paste the correct rule? I don't see an entity has field condition in it, just a condition from Commerce Rules Extra. – Ryan Szrama Feb 24 '17 at 22:06
  • Hey Ryan, thanks for taking a look at this. You're correct, I've tried a number of rules and that initial rule I posted didn't have a "entity has field" condition in it. I've updated it with my latest attempt. – Scott859 Feb 25 '17 at 4:38

Your Answer

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

Browse other questions tagged or ask your own question.