Greetings,

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 think that is issue - not certain though.

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" : [
      "commerce_rules_extra",
      "commerce_line_item",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "commerce_rules_extra_rules_condition_has_terms" : {
          "line_item" : [ "commerce-line-item" ],
          "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.

Comments

scott859 created an issue.

pyxio’s picture

hi, did you ever get this to work? it seems like a clever solution for calculations if it works.

scott859’s picture

@ drupalstrap - No I didn't, the project was put on hold so I hadn't worked on it further. Sorry I can't be of further help but if this project starts back up and I find a solution, I'll post it here.