Created
August 26, 2020 19:10
-
-
Save munts/336cd6998a19e0818c13ee12d35bdec6 to your computer and use it in GitHub Desktop.
Set WooCommerce base location so that local city/county taxes are charged if local pickup is selected as the shipping option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_countries_base_postcode', 'force_local_pickup_tax_location_zip' ); | |
function force_local_pickup_tax_location_zip(){ | |
return '90210'; | |
} | |
add_filter( 'woocommerce_countries_base_city', 'force_local_pickup_tax_location_city' ); | |
function force_local_pickup_tax_location_city(){ | |
return 'Beverly Hills'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WooCommerce Documentation uses deprecated php: https://docs.woocommerce.com/document/local-pickup/
'create_function' is deprecated since 7.2.0
add_filter( 'woocommerce_countries_base_postcode', create_function( '', 'return "80903";' ) );
add_filter( 'woocommerce_countries_base_city', create_function( '', 'return "COLORADO SPRINGS";' ) );
From php.net: "Warning This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged."