-
AuthorPosts
-
June 8, 2014 at 2:20 pm #276199
Hey there!
I’ve just purchased the Enfold theme (which is fantastic)
I’m using the theme as an e-commerce site mainly, so I’d love to be able to have a cart in the menu so it’s visible to the user (like on the Replete theme)Thanks :)
June 8, 2014 at 2:58 pm #276208Hey SomeBloke!
You could add a cart page link to the menu (Appearance > Menus). If you want to display an icon instead of the word “cart” insert this code into the menu title field:
<span aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span>
Cheers!
PeterJune 10, 2014 at 1:33 am #276774Awesome, that worked just great, thank you very much! Am just wondering if there’s any way to display the amount spent next to that, so shoppers can keep track of spending?
June 10, 2014 at 5:58 pm #277047Hey!
You could register a new shortcode which outputs the cart total. Insert this code into the child theme functions.php file or enfold/functions.php:
function avia_total_cart_ammount_shortcode() { global $woocommerce; $output = ''; if(!empty($woocommerce->cart->get_cart_total())) $output = $woocommerce->cart->get_cart_total(); return $output; } add_shortcode('av_total_cart', 'avia_total_cart_ammount_shortcode');
and use this code as menu item title:
<span aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span> [av_total_cart]
However the main problem is that it won’t update if the user clicks the “Add to cart” button on the shop page and imo this will irritate many users. Our cart icon opens the default woocommerce ajax cart widget which updates the amount automatically (via ajax) if the user adds a new item to the cart but the solution I provided above does not support such a feature.
Cheers!
PeterApril 13, 2017 at 9:58 pm #777555Sorry, don’t mean to bring up an old thread but I want something very similar to this. Instead of getting the cart total, could I instead have the total amount of items in the cart?
Here is a very small image of what I mean… So basically instead of an icon it would say CART and then instead of the shortcode pulling the $ amount, it would pull the quantity amount – Just like how it does inherently in enfold. The reason why I’m pursuing this is because I want it in the menu.
http://testing.curlyhost.com/wp-content/uploads/2017/04/Cart-w-number-in-menu.jpg
April 17, 2017 at 9:01 pm #778948Hi,
@bitojoe I replied to your thread here – https://kriesi.at/support/topic/woocommerce-cart-shortcode/. Let us continue there :)Best regards,
Yigit -
AuthorPosts
- The topic ‘Cart in menu’ is closed to new replies.