Set US:CA as the default store location

This commit is contained in:
roykho 2021-04-12 09:28:30 -07:00
parent 66b39c7ec7
commit 6c7c420d25
No known key found for this signature in database
GPG Key ID: 7B36C0EA25795714
4 changed files with 11 additions and 9 deletions

View File

@ -172,7 +172,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
*/
private function populate_payment_tasks() {
$is_woo_payment_installed = is_plugin_active( 'woocommerce-payments/woocommerce-payments.php' );
$country = explode( ':', get_option( 'woocommerce_default_country', '' ) )[0];
$country = explode( ':', get_option( 'woocommerce_default_country', 'US:CA' ) )[0];
// woocommerce-payments requires its plugin activated and country must be US.
if ( ! $is_woo_payment_installed || 'US' !== $country ) {

View File

@ -81,7 +81,7 @@ class WC_Settings_General extends WC_Settings_Page {
'title' => __( 'Country / State', 'woocommerce' ),
'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ),
'id' => 'woocommerce_default_country',
'default' => 'GB',
'default' => 'US:CA',
'type' => 'single_select_country',
'desc_tip' => true,
),

View File

@ -390,7 +390,7 @@ function wc_locate_template( $template_name, $template_path = '', $default_path
// Look within passed path within the theme - this is priority.
if ( false !== strpos( $template_name, 'product_cat' ) || false !== strpos( $template_name, 'product_tag' ) ) {
$cs_template = str_replace( '_', '-', $template_name );
$template = locate_template(
$template = locate_template(
array(
trailingslashit( $template_path ) . $cs_template,
$cs_template,
@ -1270,7 +1270,7 @@ function wc_format_country_state_string( $country_string ) {
* @return array
*/
function wc_get_base_location() {
$default = apply_filters( 'woocommerce_get_base_location', get_option( 'woocommerce_default_country' ) );
$default = apply_filters( 'woocommerce_get_base_location', get_option( 'woocommerce_default_country', 'US:CA' ) );
return wc_format_country_state_string( $default );
}
@ -1286,7 +1286,7 @@ function wc_get_base_location() {
*/
function wc_get_customer_default_location() {
$set_default_location_to = get_option( 'woocommerce_default_customer_address', 'base' );
$default_location = '' === $set_default_location_to ? '' : get_option( 'woocommerce_default_country', '' );
$default_location = '' === $set_default_location_to ? '' : get_option( 'woocommerce_default_country', 'US:CA' );
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', $default_location ) );
// Geolocation takes priority if used and if geolocation is possible.
@ -2269,9 +2269,9 @@ function wc_prevent_dangerous_auto_updates( $should_update, $plugin ) {
include_once dirname( __FILE__ ) . '/admin/plugin-updates/class-wc-plugin-updates.php';
}
$new_version = wc_clean( $plugin->new_version );
$plugin_updates = new WC_Plugin_Updates();
$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
$new_version = wc_clean( $plugin->new_version );
$plugin_updates = new WC_Plugin_Updates();
$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
if ( ! is_string( $version_type ) ) {
$version_type = 'none';
}

View File

@ -5,6 +5,8 @@
* @package WooCommerce\Tests\Countries
*/
// phpcs:disable WordPress.Files.FileName
/**
* WC_Countries tests.
*/
@ -178,7 +180,7 @@ class WC_Tests_Countries extends WC_Unit_Test_Case {
update_option( 'woocommerce_default_country', 'NO' );
$this->assertEquals( 'VAT', $countries->tax_or_vat() );
update_option( 'woocommerce_default_country', 'US' );
update_option( 'woocommerce_default_country', 'US:CA' );
$this->assertEquals( 'Tax', $countries->tax_or_vat() );
}