• Hi, I was curious if there’s any feature to use a widget or shortcode to show quote icon with a dynamic count based on the items in a users quote?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi, Are you saying about product count?

    Thread Starter anjoid

    (@anjoid)

    I was thinking something like this http://prntscr.com/e6ljb6 but for the quote?

    yes you can.. You need to play with css little bit before that you need to add this code to functions.php file

    add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
    function woocommerce_header_add_to_cart_fragment( $fragments ) {
     ob_start();
     ?>
     <span class="cart-contents"><?php echo sprintf (_n( '%d', '%d', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?></span> 
     <?php
     $fragments['span.cart-contents'] = ob_get_clean();
     return $fragments;
    }

    and this to your front end template or php file

    <span class="cart-contents"><?php echo sprintf ( _n( '%d', '%d', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?></span>

    It works as you wish..

    if you dont want any content you just need to go with the code to edit.

    http://pepperandpink.com/

    here is live example

    Thread Starter anjoid

    (@anjoid)

    Awesome thank you i’ll give this a shot!

    Thread Starter anjoid

    (@anjoid)

    Hey so i was able to get this up and working but one issue, it’s pulling the cart quantity instead of the quote quantity. How can I pull the number of items in quote?

    Thread Starter anjoid

    (@anjoid)

    Another thing I was curious of is it possible to only show if there’s items in the quote? So if there’s 0 items in quote the span is not visible? Extension is great otherwise very pleased.

    Could you give any kind of mockup the way you want.

    Thread Starter anjoid

    (@anjoid)

    I have it in place and it looks great just would like it to show quote quantity and not cart quantity and if possible not show if quote is empty

    https://www.surveillance-video.com/cctvvideo/

    If you add item to cart you will see the count for both cart and quote icon goes up

    Awesome, I am sorry i am not getting about the quote you are saying. do you have any mockup like what you wanted to show. in quote icon what you would like to show?

    Thread Starter anjoid

    (@anjoid)

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Add icon with count?’ is closed to new replies.