• Resolved Vadim

    (@vadimdude)


    Hello,

    I had to use an :after pseudo selector for the <span class="cartcontents"> element to add ” in cart” to the menu item’s label in order to achieve:

    • 2 items in cart

    I suggest an option in the plugin preferences to allow this kind of customization from the backend

    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! This is something you can do in the pro version directly in the settings. If you want to do this in the free version and prefer a non-CSS solution you can use the wpmenucart_menu_item_a_content filter

    Thread Starter Vadim

    (@vadimdude)

    I see. Sorry for not thoroughly checking the pro version features and thank you for that filter.
    However, using the suggested filter I’m unable to adjust that label. I use the following code in functions.php:

    add_filter('wpmenucart_menu_item_a_content', 'adjust_cart_menu_item_label');
    function adjust_cart_menu_item_label($menu_item_a_content){
      return $menu_item_a_content . ' in cart';
    }

    and during debugging, the value of the $menu_item_a_content variable is the following:

    <i class="wpmenucart-icon-shopping-cart-0"></i><span class="cartcontents">3 items</span>

    Thread Starter Vadim

    (@vadimdude)

    Wow, I just discovered that it only doesn’t show up in Firefox Developer Edition. It actually briefly flashes the ” in cart” part on page load, then disappears.

    In all other browsers, it works fine

    Plugin Contributor Ewout

    (@pomegranate)

    flashing would signify the ajax fragments are still loaded from sessionstorage (this doesnt get cleared on a hard refresh). You can invalidate the sessionstorage by adding something to the cart, or simply closing and reopening the browser tab.

    Thread Starter Vadim

    (@vadimdude)

    Yeah, it’s all fine now in Firefox Developer Edition lol
    Thanks a lot for all the help!

    Plugin Contributor Ewout

    (@pomegranate)

    You’re welcome! If you can spare a moment for a plugin review here on www.ads-software.com we always appreciate that.

    Thanks and have a fantastic day!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Feature suggestion: custom label’ is closed to new replies.