Search...
hideMiniCart( )
Hides the Mini Cart.
Description
The hideMiniCart()
function hides the Mini Cart.
Learn more about the Mini Cart.
Note: This API will fail when viewing the site on mobile because there is no Mini Cart on the mobile site.
Syntax
function hideMiniCart(): void
hideMiniCart Parameters
This function does not take any parameters.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
Show and hide the Mini Cart
Add products to the cart, then show the Mini Cart. After 3 seconds, hide the Mini Cart.
Copy Code
1import { cart } from 'wix-stores-frontend';2import { formFactor } from 'wix-window-frontend';34const products = [{5 "productId": "0873ed58-f88d-77d1-4566-afd4c50d253e",6 "quantity": 27}];89cart.addProducts(products)10 .then(() => {11 // Only show the Mini Cart if the site is not being viewed on mobile12 if (formFactor !== "Mobile") {13 cart.showMiniCart();14 // After displaying the Mini Cart for 3 seconds, hide the Mini Cart15 setTimeout(() => cart.hideMiniCart(), 3000);16 }17 })18 .catch((error) => {19 console.error(error);20 });21