Ensure base shipping is set. Closes #366.
This commit is contained in:
parent
71733c2412
commit
07d7cfd4a3
|
@ -570,7 +570,7 @@ class woocommerce_countries {
|
|||
function shipping_to_prefix() {
|
||||
global $woocommerce;
|
||||
$return = '';
|
||||
if (in_array($woocommerce->customer->get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('to the', 'woothemes');
|
||||
if (in_array($woocommerce->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('to the', 'woothemes');
|
||||
else $return = __('to', 'woothemes');
|
||||
return apply_filters('woocommerce_countries_shipping_to_prefix', $return, $woocommerce->customer->get_shipping_country());
|
||||
}
|
||||
|
@ -579,8 +579,8 @@ class woocommerce_countries {
|
|||
function estimated_for_prefix() {
|
||||
global $woocommerce;
|
||||
$return = '';
|
||||
if (in_array($woocommerce->customer->get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('the', 'woothemes') . ' ';
|
||||
return apply_filters('woocommerce_countries_estimated_for_prefix', $return, $woocommerce->customer->get_shipping_country());
|
||||
if (in_array($this->get_base_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('the', 'woothemes') . ' ';
|
||||
return apply_filters('woocommerce_countries_estimated_for_prefix', $return, $this->get_base_country());
|
||||
}
|
||||
|
||||
/** Correctly name tax in some countries VAT on the frontend */
|
||||
|
|
|
@ -37,7 +37,36 @@ class woocommerce_customer {
|
|||
$_SESSION['calculated_shipping'] = false;
|
||||
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
/** set location to base location */
|
||||
function set_to_base() {
|
||||
$default = get_option('woocommerce_default_country');
|
||||
if (strstr($default, ':')) :
|
||||
$country = current(explode(':', $default));
|
||||
$state = end(explode(':', $default));
|
||||
else :
|
||||
$country = $default;
|
||||
$state = '';
|
||||
endif;
|
||||
$_SESSION['customer']['country'] = $country;
|
||||
$_SESSION['customer']['state'] = $state;
|
||||
$_SESSION['customer']['postcode'] = '';
|
||||
}
|
||||
|
||||
/** set shipping location to base location */
|
||||
function set_shipping_to_base() {
|
||||
$default = get_option('woocommerce_default_country');
|
||||
if (strstr($default, ':')) :
|
||||
$country = current(explode(':', $default));
|
||||
$state = end(explode(':', $default));
|
||||
else :
|
||||
$country = $default;
|
||||
$state = '';
|
||||
endif;
|
||||
$_SESSION['customer']['shipping_country'] = $country;
|
||||
$_SESSION['customer']['shipping_state'] = $state;
|
||||
$_SESSION['customer']['shipping_postcode'] = '';
|
||||
}
|
||||
|
||||
/** Is customer outside base country? */
|
||||
|
|
|
@ -55,7 +55,7 @@ function woocommerce_cart( $atts ) {
|
|||
|
||||
else :
|
||||
|
||||
$woocommerce->customer->set_shipping_location( '', '', '' );
|
||||
$woocommerce->customer->set_shipping_to_base();
|
||||
$woocommerce->add_message( __('Shipping costs updated.', 'woothemes') );
|
||||
|
||||
endif;
|
||||
|
|
Loading…
Reference in New Issue