Variations maintain selections after adding to cart. Closes #926.
This commit is contained in:
parent
c6d6fd7901
commit
06398f4a5b
|
@ -654,7 +654,7 @@ class WC_Cart {
|
|||
$woocommerce->add_error( __('You cannot add that product to the cart since the product is out of stock.', 'woocommerce') );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Downloadable/virtual qty check
|
||||
if ( $product_data->is_sold_individually() ) {
|
||||
$in_cart_quantity = ( $cart_item_key ) ? $this->cart_contents[$cart_item_key]['quantity'] + $quantity : $quantity;
|
||||
|
|
|
@ -154,6 +154,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Menu count for orders requiring admin action
|
||||
* Feature - 'supports' function for gateways.
|
||||
* Feature - Ajax powered coupon form on checkout.
|
||||
* Tweak - Variations maintain selections after adding to cart.
|
||||
* Tweak - Improvements to the order tracking code, including better error messages
|
||||
* Tweak - EU states for tax
|
||||
* Tweak - woocommerce_shipping_chosen_method hook
|
||||
|
|
|
@ -21,7 +21,10 @@ global $woocommerce, $product, $post;
|
|||
<option value=""><?php echo __('Choose an option', 'woocommerce') ?>…</option>
|
||||
<?php if(is_array($options)) : ?>
|
||||
<?php
|
||||
$selected_value = (isset($selected_attributes[sanitize_title($name)])) ? $selected_attributes[sanitize_title($name)] : '';
|
||||
if ( empty( $_POST ) )
|
||||
$selected_value = ( isset( $selected_attributes[ sanitize_title( $name ) ] ) ) ? $selected_attributes[ sanitize_title( $name ) ] : '';
|
||||
else
|
||||
$selected_value = isset( $_POST[ 'attribute_' . sanitize_title( $name ) ] ) ? $_POST[ 'attribute_' . sanitize_title( $name ) ] : '';
|
||||
|
||||
// Get terms if this is a taxonomy - ordered
|
||||
if (taxonomy_exists(sanitize_title($name))) :
|
||||
|
|
|
@ -388,7 +388,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
// If we added the product to the cart we can now do a redirect, otherwise just continue loading the page to show errors
|
||||
if ($added_to_cart) {
|
||||
|
||||
$url = apply_filters('add_to_cart_redirect', $url);
|
||||
$url = apply_filters( 'add_to_cart_redirect', $url );
|
||||
|
||||
// If has custom URL redirect there
|
||||
if ( $url ) {
|
||||
|
|
Loading…
Reference in New Issue