Commerce Rule For Sales Tax On Shipping To One State

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
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Commerce Rule For Sales Tax On Shipping To One State

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.