Skip to content

Commit

Permalink
Minor checkout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Feb 18, 2012
1 parent 4925069 commit 054ca02
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
20 changes: 16 additions & 4 deletions classes/class-wc-checkout.php
Expand Up @@ -550,8 +550,11 @@ function get_value( $input ) {
global $woocommerce; global $woocommerce;


if (isset( $_POST[$input] ) && !empty($_POST[$input])) : if (isset( $_POST[$input] ) && !empty($_POST[$input])) :

return esc_attr($_POST[$input]); return esc_attr($_POST[$input]);

elseif (is_user_logged_in()) : elseif (is_user_logged_in()) :

if ($meta = get_user_meta( get_current_user_id(), $input, true )) return $meta; if ($meta = get_user_meta( get_current_user_id(), $input, true )) return $meta;


$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
Expand All @@ -560,10 +563,19 @@ function get_value( $input ) {
endif; endif;


else : else :


if ($input == "billing_country") : // If we are here then the user is not logged in - try to use the session data, otherwise default to base
return $woocommerce->countries->get_base_country(); if ($input == "billing_country") return ($woocommerce->customer->get_country()) ? $woocommerce->customer->get_country() : $woocommerce->countries->get_base_country();
endif;
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; endif;
} }
Expand Down
12 changes: 7 additions & 5 deletions readme.txt
Expand Up @@ -85,15 +85,17 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
== Changelog == == Changelog ==


= 1.4.4 = = 1.4.4 =
* Trigger 'change' event on the hidden variation_id input * Fix for remove coupon links after ajax update of shipping
* Load non-minified woocommerce.js file if SCRIPT_DEBUG is on * Fix for reducing/increasing stock + notifications
* Fix for reducing/increasing stock notifications
* Don't reset shipping method on cart during every update * 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 * Method availability (country) for local pickup/delivery
* Fixed permalinks in shortcodes * Fixed get_permalink in shortcodes
* Install process tweaks (for flushing post type rules) * Install process tweaks (for flushing post type rules)
* data-min argument/option for quantity inputs * 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 = = 1.4.3 - 16/02/2012 =
* Fix for variation shipping class detection * Fix for variation shipping class detection
Expand Down
3 changes: 2 additions & 1 deletion shortcodes/shortcode-cart.php
Expand Up @@ -52,7 +52,8 @@ function woocommerce_cart( $atts ) {
$woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') ); $woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') );


else : else :


$woocommerce->customer->set_to_base();
$woocommerce->customer->set_shipping_to_base(); $woocommerce->customer->set_shipping_to_base();
$woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') ); $woocommerce->add_message( __('Shipping costs updated.', 'woocommerce') );


Expand Down
4 changes: 2 additions & 2 deletions templates/cart/totals.php
Expand Up @@ -23,7 +23,7 @@
<?php if ($woocommerce->cart->get_discounts_before_tax()) : ?> <?php if ($woocommerce->cart->get_discounts_before_tax()) : ?>


<tr class="discount"> <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> <td>-<?php echo $woocommerce->cart->get_discounts_before_tax(); ?></td>
</tr> </tr>


Expand Down Expand Up @@ -153,7 +153,7 @@
<?php if ($woocommerce->cart->get_discounts_after_tax()) : ?> <?php if ($woocommerce->cart->get_discounts_after_tax()) : ?>


<tr class="discount"> <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> <td>-<?php echo $woocommerce->cart->get_discounts_after_tax(); ?></td>
</tr> </tr>


Expand Down

0 comments on commit 054ca02

Please sign in to comment.