We want to only apply sales tax on orders shipped to a particular State. I tried to cobble together the following rule from the included ‘Price Component’ and it seems to apply tax on shipping for -all- orders, regardless of the address component.
Can someone look at this and tell me what I’m doing wrong?
{ "rules_apply_taxes_to_shipping" : { "LABEL" : "Apply Taxes to Shipping", "PLUGIN" : "reaction rule", "OWNER" : "rules", "REQUIRES" : [ "commerce_order", "commerce_tax", "commerce_shipping" ], "ON" : { "commerce_shipping_calculate_rate" : [] }, "IF" : [ { "commerce_order_compare_address" : { "commerce_order" : [ "commerce-line-item:order" ], "address_field" : "commerce_customer_shipping|commerce_customer_address", "address_component" : "administrative_area", "value" : "WA" } } ], "DO" : [ { "commerce_tax_calculate_by_type" : { "commerce_line_item" : [ "commerce_line_item" ], "tax_type_name" : "sales_tax" } } ] } }
Here is the Rules Evaluation Log. Apparently the rule isn’t even firing. How do I figure -that- out?
0 ms Reacting on event Calculating the sell price of a product. 3.479 ms Evaluating conditions of rule Calculate taxes: VAT. [edit] 3.489 ms AND evaluated to TRUE. 0 ms Rule Calculate taxes: VAT fires. 0.138 ms Evaluating the action commerce_tax_calculate_by_type. [edit] 4.267 ms Rule Calculate taxes: VAT has fired. 7.837 ms Evaluating conditions of rule Calculate Bundle Product Price. [edit] 7.845 ms AND evaluated to TRUE. 0 ms Rule Calculate Bundle Product Price fires. 0.093 ms Evaluating the action commerce_product_bundle_calculate_price. [edit] 4.688 ms Rule Calculate Bundle Product Price has fired. 12.594 ms Evaluating conditions of rule Quote Required. [edit] 12.609 ms AND evaluated to TRUE. 0 ms Rule Quote Required fires. 0.012 ms Rule Quote Required has fired. 12.692 ms Evaluating conditions of rule Calculate taxes: Sales tax. [edit] 12.699 ms AND evaluated to TRUE. 0 ms Rule Calculate taxes: Sales tax fires. 0.111 ms Evaluating the action commerce_tax_calculate_by_type. [edit] 0 ms Executing rule Calculate Sample Michigan Sales Tax 6%. 0.169 ms Evaluating conditions of rule Calculate Sample Michigan Sales Tax 6%. [edit] 2.254 ms The condition commerce_order_compare_address evaluated to TRUE [edit] 2.263 ms AND evaluated to TRUE. 0 ms Rule Calculate Sample Michigan Sales Tax 6% fires. 0.089 ms Evaluating the action commerce_tax_rate_apply. [edit] 0.571 ms Added the provided variable applied_tax of type commerce_price [edit] 0.6 ms Rule Calculate Sample Michigan Sales Tax 6% has fired. 2.905 ms Finished executing of rule Calculate Sample Michigan Sales Tax 6%. 5.114 ms Rule Calculate taxes: Sales tax has fired. 17.894 ms Evaluating conditions of rule Unset the price of disabled products in the cart. [edit] 18.145 ms The condition data_is_empty evaluated to FALSE [edit] 18.334 ms The condition entity_has_field evaluated to TRUE [edit] 19.067 ms The condition data_is evaluated to FALSE [edit] 19.076 ms AND evaluated to FALSE. 19.102 ms Evaluating conditions of rule Quote Required. [edit] 19.195 ms The condition data_is_empty evaluated to FALSE [edit] 19.296 ms The condition entity_has_field evaluated to TRUE [edit] 19.708 ms The condition data_is evaluated to FALSE [edit] 19.716 ms AND evaluated to FALSE. 19.737 ms Finished reacting on event Calculating the sell price of a product.
Sponsored by SupremePR