Auto apply. #1641.

This commit is contained in:
Mike Jolley 2012-11-15 15:12:42 +00:00
parent cd42e90926
commit d54bdb6609
2 changed files with 6 additions and 1 deletions

View File

@ -1679,6 +1679,11 @@ class WC_Cart {
}
$this->applied_coupons[] = $coupon_code;
// Choose free shipping
if ( $the_coupon->enable_free_shipping() ) {
$woocommerce->session->chosen_shipping_method = 'free_shipping';
}
$this->set_session();

View File

@ -202,7 +202,7 @@ class WC_Shipping {
$_available_methods = $this->get_available_shipping_methods();
// Get chosen method
if ( ! empty( $woocommerce->session->chosen_shipping_method ) && isset( $woocommerce->session->available_methods_count ) && $woocommerce->session->available_methods_count == sizeof( $_available_methods ) )
if ( ! empty( $woocommerce->session->chosen_shipping_method ) )
$chosen_method = $woocommerce->session->chosen_shipping_method;
$woocommerce->session->available_methods_count = sizeof( $_available_methods );