Minor checkout fixes

This commit is contained in:
Mike Jolley 2012-02-18 10:08:12 +00:00
parent 4925069006
commit 054ca02937
4 changed files with 27 additions and 12 deletions

View File

@ -550,8 +550,11 @@ class WC_Checkout {
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();
@ -561,9 +564,18 @@ class WC_Checkout {
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;
}

View File

@ -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

View File

@ -53,6 +53,7 @@ function woocommerce_cart( $atts ) {
else :
$woocommerce->customer->set_to_base();
$woocommerce->customer->set_shipping_to_base();
$woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') );

View File

@ -23,7 +23,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
<?php if ($woocommerce->cart->get_discounts_before_tax()) : ?>
<tr class="discount">
<th><?php _e('Cart Discount', 'woocommerce'); ?> <a href="<?php echo add_query_arg('remove_discounts', '1') ?>"><?php _e('[Remove]', 'woocommerce'); ?></a></th>
<th><?php _e('Cart Discount', 'woocommerce'); ?> <a href="<?php echo add_query_arg('remove_discounts', '1', $woocommerce->cart->get_cart_url()) ?>"><?php _e('[Remove]', 'woocommerce'); ?></a></th>
<td>-<?php echo $woocommerce->cart->get_discounts_before_tax(); ?></td>
</tr>
@ -153,7 +153,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
<?php if ($woocommerce->cart->get_discounts_after_tax()) : ?>
<tr class="discount">
<th><?php _e('Order Discount', 'woocommerce'); ?> <a href="<?php echo add_query_arg('remove_discounts', '2') ?>"><?php _e('[Remove]', 'woocommerce'); ?></a></th>
<th><?php _e('Order Discount', 'woocommerce'); ?> <a href="<?php echo add_query_arg('remove_discounts', '2', $woocommerce->cart->get_cart_url()) ?>"><?php _e('[Remove]', 'woocommerce'); ?></a></th>
<td>-<?php echo $woocommerce->cart->get_discounts_after_tax(); ?></td>
</tr>