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 const items_in_cart = Cookies.get( 'woocommerce_items_in_cart' ); 13 14 if ( items_in_cart > 0 ) { 15 $( '.empty-wpmenucart' ).removeClass( 'empty-wpmenucart' ); 16 } else if ( ! ( wpmenucart_ajax_assist.always_display ) ) { 17 $( '.wpmenucartli' ).addClass( 'empty-wpmenucart' ); 18 $( '.wpmenucart-shortcode' ).addClass( 'empty-wpmenucart' ); 19 } 20 21 $( document ).trigger( 'wpmenucart_menu_classes_updated', [ items_in_cart ] ); 22 } 23} );
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.