---
title: openCart
description: Shows the cart to the buyer.
source_url:
  html: 'https://shopify.dev/docs/api/storefront-events-and-actions/actions/open-cart'
  md: >-
    https://shopify.dev/docs/api/storefront-events-and-actions/actions/open-cart.md
api_name: storefront-events-and-actions
---

# open​Cart

Shows the cart to the buyer. The storefront decides whether that means opening a drawer or navigating to the cart page.

You can use this after adding an item, so the buyer sees what happened without your app needing to know how the cart is presented.

It takes no arguments and resolves with nothing. Without a configuration, it opens a [cart drawer it recognizes](https://shopify.dev/docs/api/storefront-events-and-actions/actions/configure#how-the-defaults-recognize-a-theme), and navigates to `/cart` when it finds none.

## open​Cart()

Shows the cart to the buyer. The storefront decides whether that means opening a drawer or navigating to the cart page.

### Returns

* **Promise\<void>**

Examples

### Examples

* ####

  ##### Call the action

  ```javascript
  await Shopify.actions.updateCart({
    lines: [{ merchandiseId: variantId, quantity: 1 }],
  });

  await Shopify.actions.openCart();
  ```

* ####

  ##### Configure the action

  ```javascript
  Shopify.actions.openCart.configure({
    async handler() {
      const drawer = document.querySelector('cart-drawer');

      if (drawer) {
        drawer.open();
      } else {
        window.location.href = '/cart';
      }
    },
  });
  ```

***
