In order to access additional fields, you have to do one of two things in your conditions:
- Use the Entity has field condition to ensure the field you want to access exists on the variable you want to use it for, or
- Use the Data comparison condition to check the type of the entity (i.e. product type) to gain access to every field on the entity.
This example Rule can be imported into your site to demonstrate this aspect of Rules. It will apply a 10% discount to any product whose SKU is PROD-01:
{ "rules_discount_product_one" : {
"LABEL" : "Discount Product One",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
"ON" : [ "commerce_product_calculate_sell_price" ],
"IF" : [
{ "data_is" : { "data" : [ "line-item:type" ], "value" : "product" } },
{ "data_is" : { "data" : [ "line-item:commerce-product:sku" ], "value" : "PROD-01" } }
],
"DO" : [
{ "commerce_line_item_unit_price_multiply" : { "line_item" : [ "line_item" ], "amount" : ".9" } }
]
}
}