Create a shipping zone containing the store’s country when enabling shipping calculation from the setup wizard.
This commit is contained in:
parent
e96a1eb744
commit
f2f803d007
|
@ -532,6 +532,18 @@ class WC_Admin_Setup_Wizard {
|
||||||
if ( $enable_shipping ) {
|
if ( $enable_shipping ) {
|
||||||
update_option( 'woocommerce_ship_to_countries', '' );
|
update_option( 'woocommerce_ship_to_countries', '' );
|
||||||
WC_Admin_Notices::add_notice( 'no_shipping_methods' );
|
WC_Admin_Notices::add_notice( 'no_shipping_methods' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a shipping zone containing the country the store is located in.
|
||||||
|
*/
|
||||||
|
$default_country = get_option( 'woocommerce_default_country' );
|
||||||
|
$location = wc_format_country_state_string( $default_country );
|
||||||
|
|
||||||
|
$zone = new WC_Shipping_Zone( null );
|
||||||
|
$zone->set_zone_order( 0 );
|
||||||
|
$zone->add_location( $location['country'], 'country' );
|
||||||
|
$zone->set_zone_name( $zone->get_formatted_location() );
|
||||||
|
$zone->save();
|
||||||
} else {
|
} else {
|
||||||
update_option( 'woocommerce_ship_to_countries', 'disabled' );
|
update_option( 'woocommerce_ship_to_countries', 'disabled' );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue