Jigoshop & Top menu => items in the cart (2 posts)

  1. kalote
    Posted 3 years ago #


    Im currently developping a wordpress website with e-commerce stuff. I used the wordpress creation menu (very nice BTW), but i would like to have the number of items in the cart next to my "cart" link in the top menu.
    I already have the php code to retrieve the number of items, but i don't know where to put it. I tried to find across php pages in my wordpress installation, but i haven't been able to find it.

    Can someone has a suggestion for this problem ?
    Thanks in advance : )

    [No bumping. If it's that urgent, consider hiring someone.]

  2. carmat
    Posted 3 years ago #

    Can you share the PHP code you are using? It may need to be used outside a loop.

    I am essentially looking for an item counter to determine whether I need to show the cart or not.


    [EDIT: 08/01/2013]
    I managed to get this to work for myself. I have it in my theme's sidebar.php file

    	if (!dynamic_sidebar( 'sidebar-cart' )) {
    		$args = array( 'post_type' => 'product' );
    		$cart_quantity = sprintf(_n('%d', '%d', jigoshop_cart::$cart_contents_count), jigoshop_cart::$cart_contents_count);
    		if ( $cart_quantity > 0 ) sidebar_cart($args);

Topic Closed

This topic has been closed to new replies.

About this Topic