• Resolved Jim

    (@jwmc)


    This is an impressive plugin, and I appreciate that you’ve put filters in there.
    I’m trying to filter so that only the count shows, not the words ‘item’ or ‘items’. (I’m using a backround image behind it that says “Pending bookings” and the word isn’t helpful)

    Here’s what I’m trying:

    /* Filter WP Menu Cart to show only number of items */
    add_filter ( 'wpmenucart_menu_item_a_content', 'cc_menu_cart', 10, 4 );
    function cc_menu_cart( $menu_item_a_content, $menu_item_icon, $cart_contents, $item_data ) {
    	$menu_item_a_content = '<span class="cartcontents">'.$item_data['cart_contents_count'].'</span>';
    	return $menu_item_a_content;
    }

    When I refresh, I can see it as intended momentarily flashing, but when everything finishes loading the word ‘item’ is there. Is my filter code correct?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! It the item flashes it means the WooCommerce AJAX functions are still using the data as stored in the browsers SessionStorage (which is like cache, but different). You can either close & reopen the browser tab, or add something to the cart – both of these actions will force an update of the SessionStorage with the new HTML fragments.

    Hope that helps!

Viewing 1 replies (of 1 total)

The topic ‘filtering wpmenucart_menu_item_a_content’ is closed to new replies.