Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to display the WooCommerce mini-cart on my WordPress site?

I'm developing a website whereby I would like customers to be able to constantly view the contents of their cart so they can add/remove items on the fly (using WooCommerce).

The theme I'm currently using is Flatsome (with the UXBuilder)

I've noticed there is a template for the WooCommerce mini-cart in woocommerce/templates/mini-cart.php. This looks like what I want to be displayed on my page

I have a plugin called WooCommerce Product Tables that (I believe) displays this mini-cart like this

I was wondering if there is any way for me to display this as a fixed element (within a div perhaps) on my page?

I'm quite inexperienced, so any help is appreciated :)

like image 573
jvandervoo Avatar asked Apr 26 '18 00:04

jvandervoo


People also ask

How do I display the mini cart in WooCommerce?

Select Menu: Select the menu in which you want to display the men. Display Shopping Cart Icon: Select yes to display the shipping cart icon. Choose a Cart Icon: Choose a cart icon that you want to display or upload a custom icon. Choose Custom Icon: Upload a custom icon for the mini cart.

How do I add the cart icon to my WordPress header?

Step 1: Go to WordPress Admin > Appearance > Customize > Header > Header Style and Data. Step 2: Find setting “Mini Cart” at the end of the section. Step 3: Select “On” button and you will be finding one drop down menu called “Mini Cart Sidebar” under this setting.


1 Answers

As Bhoomi suggested, using woocommerce_mini_cart(); works however ajax cart doesn't update the minit cart.

Using this method I suggest to wrap mini_cart function with "widget_shopping_cart_content" woocommerce class, for example :

<div class="widget_shopping_cart_content"><?php woocommerce_mini_cart(); ?></div>

So with ajax add to cart, the mini cart is updated also.

like image 111
Fab Avatar answered Sep 20 '22 15:09

Fab