WPML Tax Rates Done Right

0.0/5
<?php
function my_function_with_wc_functions()
{
    function example_callback()
    {
        global $woocommerce;
        $woocommerce->customer->set_billing_country(
            strtoupper(apply_filters('wpml_current_language', null))
        );
    }
    function default_location_override($location)
    {
        global $sitepress;
        $location['country'] = strtoupper(
            apply_filters('wpml_current_language', null)
        );
        return $location;
    }
    add_action('wpml_language_has_switched', example_callback);
    add_filter(
        'woocommerce_customer_default_location_array',
        'default_location_override',
        9999,
        1
    );
    add_filter(
        'default_checkout_billing_country',
        'change_default_checkout_country'
    );
    add_filter(
        'default_checkout_shipping_country',
        'change_default_checkout_country'
    );
    function change_default_checkout_country($default)
    {
        return strtoupper(apply_filters('wpml_current_language', null));
    }
//echo "<!-- Test:" . print_r(wc_get_customer_default_location())  . "-->";
}
add_action('wp_loaded', 'my_function_with_wc_functions');

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet was fetched automatically from WPDistro.cz projects.

Author

Tags

This snippet is untagged