{ "rules_shipping_small_and_medium_tins" : { "LABEL" : "Shipping: Small and Medium Tin", "PLUGIN" : "rule", "REQUIRES" : [ "rules", "php" ], "USES VARIABLES" : { "line_item" : { "label" : "Line Item", "type" : "commerce_line_item" }, "shipping_cost_line_item_tin_s_m" : { "label" : "Shipping Cost for Line Item S\/M Tin", "type" : "decimal", "parameter" : false } }, "IF" : [ { "entity_has_field" : { "entity" : [ "line-item" ], "field" : "commerce_product" } }, { "data_is" : { "data" : [ "line-item:commerce-product:type" ], "value" : "party_favors_saleable" } } ], "DO" : [ { "data_calc" : { "USING" : { "input_1" : [ "line-item:quantity" ], "op" : "\/", "input_2" : "16" }, "PROVIDE" : { "result" : { "pf_small_quantities" : "PF_Small Quantities" } } } }, { "variable_add" : { "USING" : { "type" : "decimal", "value" : { "select" : "pf-small-quantities", "php" : { "code" : "return ceiling($value)" } } }, "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } } } }, { "data_set" : { "data" : [ "variable-added" ], "value" : [ "shipping-cost-line-item-tin-s-m" ] } } ], "PROVIDES VARIABLES" : [ "shipping_cost_line_item_tin_s_m" ] } }