showMiniCart( )


Deprecated. This function will continue to work, but a newer version is available at wix-ecom-frontend.openSideCart().

Migration Instructions

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:

  1. Add the new import statement:

    Copy
    import wixEcomFrontend from "wix-ecom-frontend";
  2. Look for any code that uses cart.showMiniCart(), and replace it with wixEcomFrontend.openSideCart().

  3. 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.

Method Declaration
Copy
function showMiniCart(): void;
Request
This method does not take any parameters
Add products to the cart, then show the Mini Cart

This example uses a deprecated function.

JavaScript
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); });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?