Turn on the mini cart
The mini cart is a cart that slides in from the side on every page, in the same design as the cart and checkout. It slides from the left on right-to-left pages.
1. Turn it on#
- Go to WooCommerce > Bricks Templates > Mini cart.
- Turn on Turn on the mini cart. It loads on every page except the cart and checkout.
- Leave Open after adding to cart on to open it when a product is added with WooCommerce’s AJAX add to cart (shop and archive buttons).
- Save.
2. Open it from Bricks#
- In Bricks, edit your header template.
- Select your cart icon, button or any element.
- Add the class
nbwt-cart-openin the Bricks class field. - Save the header.
If the element is a link to the cart page, it still works as a link when the mini cart is off.
Opens when clicking on the Mini cart tab sets the selector. Separate several with commas, for example .nbwt-cart-open, .header-cart.
3. Show the item count#
Add a Shortcode element to your header:
| Shortcode | What it prints |
|---|---|
[nbwt_cart_count] | The live number of items. |
[nbwt_cart_button] | A ready cart icon with its count, which opens the mini cart. |
The count updates after every cart change.
From your own code#
nbwtMiniCart.open();
nbwtMiniCart.close(); See JavaScript API.
Note
With YITH Added to Cart Popup or Barn2 Fast Cart active, the drawer doesn’t open after an add to cart, so the two don’t open together.