Reveal cart on adding_to_cart action
This commit is contained in:
parent
3fe3f969cc
commit
422b07b262
|
@ -54,8 +54,12 @@ jQuery(document).ready(function($) {
|
|||
|
||||
/* Cart hiding */
|
||||
if ( $.cookie( "woocommerce_items_in_cart" ) > 0 )
|
||||
jQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
|
||||
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
|
||||
else
|
||||
jQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').hide();
|
||||
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').hide();
|
||||
|
||||
$('body').bind( 'adding_to_cart', function() {
|
||||
$('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').show();
|
||||
} );
|
||||
|
||||
});
|
|
@ -1 +1 @@
|
|||
jQuery(document).ready(function(e){$supports_html5_storage="sessionStorage"in window&&window.sessionStorage!==null;$fragment_refresh={url:woocommerce_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(t){if(t&&t.fragments){e.each(t.fragments,function(t,n){e(t).replaceWith(n)});if($supports_html5_storage){sessionStorage.setItem("wc_fragments",JSON.stringify(t.fragments));sessionStorage.setItem("wc_cart_hash",t.cart_hash)}}}};if($supports_html5_storage){e("body").bind("added_to_cart",function(e,t,n){sessionStorage.setItem("wc_fragments",JSON.stringify(t));sessionStorage.setItem("wc_cart_hash",n)});try{var t=e.parseJSON(sessionStorage.getItem("wc_fragments")),n=sessionStorage.getItem("wc_cart_hash");if(!t||!t["div.widget_shopping_cart_content"]||n!=e.cookie("woocommerce_cart_hash"))throw"No fragment";e.each(t,function(t,n){e(t).replaceWith(n)})}catch(r){e.ajax($fragment_refresh)}}else e.ajax($fragment_refresh);e.cookie("woocommerce_items_in_cart")>0?jQuery(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():jQuery(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide()});
|
||||
jQuery(document).ready(function(e){$supports_html5_storage="sessionStorage"in window&&window.sessionStorage!==null;$fragment_refresh={url:woocommerce_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(t){if(t&&t.fragments){e.each(t.fragments,function(t,n){e(t).replaceWith(n)});if($supports_html5_storage){sessionStorage.setItem("wc_fragments",JSON.stringify(t.fragments));sessionStorage.setItem("wc_cart_hash",t.cart_hash)}}}};if($supports_html5_storage){e("body").bind("added_to_cart",function(e,t,n){sessionStorage.setItem("wc_fragments",JSON.stringify(t));sessionStorage.setItem("wc_cart_hash",n)});try{var t=e.parseJSON(sessionStorage.getItem("wc_fragments")),n=sessionStorage.getItem("wc_cart_hash");if(!t||!t["div.widget_shopping_cart_content"]||n!=e.cookie("woocommerce_cart_hash"))throw"No fragment";e.each(t,function(t,n){e(t).replaceWith(n)})}catch(r){e.ajax($fragment_refresh)}}else e.ajax($fragment_refresh);e.cookie("woocommerce_items_in_cart")>0?e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide();e("body").bind("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
|
Loading…
Reference in New Issue