Search.../

showMiniCart( )

Shows the Mini Cart.

Description

The showMiniCart() function displays 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 showMiniCart(): void

showMiniCart Parameters

This function does not take any parameters.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Add products to the cart, then show the Mini Cart

Code Example

Copy Code
1import { cart } from 'wix-stores';
2import { formFactor } from 'wix-window';
3
4const products = [{
5 "productId": "0873ed58-f88d-77d1-4566-afd4c50d253e",
6 "quantity": 2
7}];
8
9cart.addProducts(products)
10 .then(() => {
11 // Only show the Mini Cart if the site is not being viewed on mobile
12 if (formFactor !== "Mobile") {
13 cart.showMiniCart();
14 }
15 })
16 .catch((error) => {
17 console.error(error);
18 });