1/* This script is intended for sites with server side caching enabled - normally the classes in the menu would follow the cart state */ 2jQuery( function( $ ) { 3 /* Cart Hiding */ 4 if ( typeof wpmenucart_ajax_assist.shop_plugin !== 'undefined' && wpmenucart_ajax_assist.shop_plugin.toLowerCase() == 'woocommerce' ) { 5 // update on page load 6 wpmenucart_update_menu_classes(); 7 // update when cart is updated 8 $( document.body ).on( 'adding_to_cart added_to_cart updated_wc_div', wpmenucart_update_menu_classes ); 9 } 10 11 function wpmenucart_update_menu_classes() { 12 if ( typeof window.Cookies !== 'undefined' ) { // WC3.0 13 items_in_cart = Cookies.get( 'woocommerce_items_in_cart' ); 14 } else if ( typeof $.cookie !== 'undefined' && $.isFunction($.cookie) ){ // WC2.X 15 items_in_cart = $.cookie( 'woocommerce_items_in_cart' ); 16 } else { 17 return; // no business here 18 } 19 20 if ( items_in_cart > 0 ) { 21 $('.empty-wpmenucart').removeClass('empty-wpmenucart'); 22 } else if ( !(wpmenucart_ajax_assist.always_display) ) { 23 $('.wpmenucartli').addClass('empty-wpmenucart'); 24 $('.wpmenucart-shortcode').addClass('empty-wpmenucart'); 25 } 26 } 27});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.