Deprecated.
This function will continue to work, but a newer version is available at
wix-ecom-frontend.openSideCart()
.
If this function is already in your code, it will continue to work.
To stay compatible with future changes, migrate to
wix-ecom-frontend.openSideCart()
.
To migrate to the new function:
Add the new import statement:
import wixEcomFrontend from "wix-ecom-frontend";
Look for any code that uses cart.showMiniCart()
,
and replace it with wixEcomFrontend.openSideCart()
.
Test your changes to make sure your code behaves as expected.
Shows the Mini Cart.
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.
function showMiniCart(): void;
This example uses a deprecated function.
import { cart } from "wix-stores-frontend";
import { formFactor } from "wix-window-frontend";
const products = [
{
productId: "0873ed58-f88d-77d1-4566-afd4c50d253e",
quantity: 2,
},
];
cart
.addProducts(products)
.then(() => {
// Only show the Mini Cart if the site is not being viewed on mobile
if (formFactor !== "Mobile") {
cart.showMiniCart();
}
})
.catch((error) => {
console.error(error);
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.