-
AuthorPosts
-
November 2, 2015 at 6:07 pm #650034
Hey!
My site has WooCommerce installed and I’m using the shopping cart quantity and price in the menu bar. It looks GREAT! One issue I’m having is whenever I add a bundle tot he cart (a bundle could include 4 bags of product or 6 bags), it shows as “7 products in the cart” (when I add a case of 6). My website is https://taysgourmet.com/shop/
I researched this a bit and came up with this in the WooThemes documentation:
https://docs.woothemes.com/document/bundles/bundles-faq/
The mini-cart widget does not show the correct count of cart items:
When using Product Bundles, you need to make sure that your theme is using the WC()->cart->get_cart_contents_count() method to count cart items. If you donβt know how to verify this, it might be a good idea to share this information with your theme author(s). Note that by default, Bundle contents are not counted. A Bundle will be counted as one item, no matter how many products it contains.Is this something that can be fixed in a future update?
November 2, 2015 at 9:59 pm #650202Hi there,
Thanks for writing in and thank you for bringing this up. I will forward this to our developers so they can take a look at it. I can’t promise implementation or a timeline at this point, however, we do listen to our users and we’re always trying to improve. When we see something beneficial we do our best to make it happen. We’re actually working on a number of things so if this does get added to the pipeline, we’ll be sure to announce it when it’s ready. Thanks for understanding! Have a great day!
November 3, 2015 at 10:31 am #650917you guys rock, thanks!
November 3, 2015 at 10:39 am #650934I have another question pertaining to the same functionality. Is it possible to program it so that when there’s 0 items and $0 in the cart, that it just says “Cart” versus “0 Items | $0.00”?
Thanks!
November 3, 2015 at 11:46 am #651006Hi Matt,
Thanks for writing in!
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
After that, add following code in your child theme’s functions.php file:
function x_woocommerce_navbar_cart() { $cart_info = x_get_option( 'x_woocommerce_header_cart_info', 'outer-inner' ); $cart_layout = x_get_option( 'x_woocommerce_header_cart_layout', 'inline' ); $cart_style = x_get_option( 'x_woocommerce_header_cart_style', 'square' ); $cart_outer = x_get_option( 'x_woocommerce_header_cart_content_outer', 'total' ); $cart_inner = x_get_option( 'x_woocommerce_header_cart_content_inner', 'count' ); $data = array( 'icon' => '<i class="x-icon-shopping-cart" data-x-icon=""></i>', 'total' => WC()->cart->get_cart_total(), 'count' => sprintf( _n( '%d Item', '%d Items', WC()->cart->cart_contents_count, '__x__' ), WC()->cart->cart_contents_count ) ); $modifiers = array( $cart_info, strpos( $cart_info, '-' ) === false ? 'inline' : $cart_layout, $cart_style ); $cart_output = '<div class="x-cart ' . implode( ' ', $modifiers ) . '">'; if ( WC()->cart->get_cart_contents_count() == 0 ) { $cart_output .= '<span class="inner">Cart</span>'; } else { foreach ( explode( '-', $cart_info ) as $info ) { $key = ( $info == 'outer' ) ? $cart_outer : $cart_inner; $cart_output .= '<span class="' . $info . '">' . $data[$key] . '</span>'; } } $cart_output .= '</div>'; return $cart_output; }
Hope this helps. π
Thank you!
November 3, 2015 at 2:01 pm #651209oh my god. you guys are so awesome!!!! That worked perfectly. this is exactly why X Theme is my go to theme and why I have 14 licenses so far π Keep it up!
November 3, 2015 at 5:30 pm #651418You’re welcome Matt!
Always,
X -
AuthorPosts