diff --git a/classes/class-wc-checkout.php b/classes/class-wc-checkout.php index 360c27023369..e5d34ce0b67b 100644 --- a/classes/class-wc-checkout.php +++ b/classes/class-wc-checkout.php @@ -550,8 +550,11 @@ function get_value( $input ) { global $woocommerce; if (isset( $_POST[$input] ) && !empty($_POST[$input])) : + return esc_attr($_POST[$input]); + elseif (is_user_logged_in()) : + if ($meta = get_user_meta( get_current_user_id(), $input, true )) return $meta; $current_user = wp_get_current_user(); @@ -560,10 +563,19 @@ function get_value( $input ) { endif; else : - - if ($input == "billing_country") : - return $woocommerce->countries->get_base_country(); - endif; + + // If we are here then the user is not logged in - try to use the session data, otherwise default to base + if ($input == "billing_country") return ($woocommerce->customer->get_country()) ? $woocommerce->customer->get_country() : $woocommerce->countries->get_base_country(); + + if ($input == "billing_state") return ($woocommerce->customer->get_state()) ? $woocommerce->customer->get_state() : $woocommerce->countries->get_base_state(); + + if ($input == "billing_postcode") return ($woocommerce->customer->get_postcode()) ? $woocommerce->customer->get_postcode() : ''; + + if ($input == "shipping_country") return ($woocommerce->customer->get_shipping_country()) ? $woocommerce->customer->get_shipping_country() : $woocommerce->countries->get_base_country(); + + if ($input == "shipping_state") return ($woocommerce->customer->get_shipping_state()) ? $woocommerce->customer->get_shipping_state() : $woocommerce->countries->get_base_state(); + + if ($input == "shipping_postcode") return ($woocommerce->customer->get_shipping_postcode()) ? $woocommerce->customer->get_shipping_postcode() : ''; endif; } diff --git a/readme.txt b/readme.txt index a4f40508931f..8b02b2119d1d 100644 --- a/readme.txt +++ b/readme.txt @@ -85,15 +85,17 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo == Changelog == = 1.4.4 = -* Trigger 'change' event on the hidden variation_id input -* Load non-minified woocommerce.js file if SCRIPT_DEBUG is on -* Fix for reducing/increasing stock notifications +* Fix for remove coupon links after ajax update of shipping +* Fix for reducing/increasing stock + notifications * Don't reset shipping method on cart during every update +* Checkout country/state/postcode defaults to session if not logged in * Method availability (country) for local pickup/delivery -* Fixed permalinks in shortcodes +* Fixed get_permalink in shortcodes * Install process tweaks (for flushing post type rules) * data-min argument/option for quantity inputs -* Notice when the configuration may cause permalink errors +* Notice is now shown in admin when the configuration may cause permalink errors +* Trigger 'change' event on the hidden variation_id input +* Load non-minified woocommerce.js file if SCRIPT_DEBUG is on = 1.4.3 - 16/02/2012 = * Fix for variation shipping class detection diff --git a/shortcodes/shortcode-cart.php b/shortcodes/shortcode-cart.php index 4a2f931a8a5b..c2b7b226c705 100644 --- a/shortcodes/shortcode-cart.php +++ b/shortcodes/shortcode-cart.php @@ -52,7 +52,8 @@ function woocommerce_cart( $atts ) { $woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') ); else : - + + $woocommerce->customer->set_to_base(); $woocommerce->customer->set_shipping_to_base(); $woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') ); diff --git a/templates/cart/totals.php b/templates/cart/totals.php index 7a6ba0bbde22..d0ba0078d871 100644 --- a/templates/cart/totals.php +++ b/templates/cart/totals.php @@ -23,7 +23,7 @@ cart->get_discounts_before_tax()) : ?> - + -cart->get_discounts_before_tax(); ?> @@ -153,7 +153,7 @@ cart->get_discounts_after_tax()) : ?> - + -cart->get_discounts_after_tax(); ?>