JS SDK to open the cart summary/checkout page

Currently I am using snipcart-checkout button as below to open the cart summary/checkout page. However, I need to do some work (e.g. check the products, make an API call etc) before I initiate the cart summary/checkout button.

Is there a way with JS SDK to open the cart summary/checkout page? Can you share sample code how to do it? Thanks!

  <button
    class="snipcart-checkout btn btn-primary"
    type="button"
    @click="checkout()" >
    Checkout
  </button>

You may manually trigger the checkout page with

window.location.hash = '/checkout'

Maybe this helps?

Hi @keithlei01, thanks for reaching out!

You can do that with

Snipcart.api.theme.cart.open()

And

Snipcart.api.theme.cart.close()

Let me know if you have further questions!

Thanks.