Implement network-wide WooCommerce Tax settings - WP Global Cart
documentation-template-default,single,single-documentation,postid-16230,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive

Implement network-wide WooCommerce Tax settings

WP Global Cart / Implement network-wide WooCommerce Tax settings
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

Implement network-wide WooCommerce Tax settings

WooCommerce Tax area provides the necessary tools to create the required taxation for on-sale products. Setting up Taxes in WooCommerce is straightforward, through WooCommerce > Settings > Tax interface:

Different tax classes and appropriate Rates, per specific Country, State, Zip, City etc area configurable:

On check-out, the current shop tax set-up applies to all products in the shopping cart. The check-out location is settable through the plugin options, or this can be free to choose by the customer. I such case, the Tax rates need to synchronize on all shops, to provide unitary prices and costs. Setting up and updating the taxes on the network is not be the best solution, this takes time and opens the possibility for human errors.

A Global Tax is possible for all shops in the network through a custom code. This ensures all data is loaded from the main shop. Also saved to the same site ( or any other in the network, if required ). The global tax is also suitable for all check-out types such as Single Check-out type and Each Store check-out.

The following code is required for a Global Tax setup. This goes within a custom file on /wp-content/mu-plugins/ directory:

        global $wpdb;
        define('WooGC_GlobalTax_woocommerce_tax_rates',                     $wpdb->base_prefix . 'woocommerce_tax_rates');
        define('WooGC_GlobalTax_wc_tax_rate_classes',                       $wpdb->base_prefix . 'wc_tax_rate_classes');
        add_filter('query', 'woo_gc_query');
        function woo_gc_query( $query )
                global $wpdb;
                //check for term_exists() query  OR  run_seccond_pass       
                if ( preg_match( "/wp(_\d+)?_woocommerce_tax_rates/i", $query ) ||  preg_match( "/wp(_\d+)?_wc_tax_rate_classes/i", $query ) )

                        $replace_table      =   $wpdb->prefix . 'woocommerce_tax_rates';
                        $replacement_table  =   WooGC_GlobalTax_woocommerce_tax_rates;
                        $query  =   str_replace( $replace_table, $replacement_table, $query);                         
                        $replace_table      =   $wpdb->prefix . 'wc_tax_rate_classes';
                        $replacement_table  =   WooGC_GlobalTax_wc_tax_rate_classes;
                        $query  =   str_replace( $replace_table, $replacement_table, $query);                         
                return $query;

Using the above code, all Tax Classes and individual Rates becomes available to all shops in the network. Add New and Updates are available from any site.

Would love your thoughts, please comment.x