Cart and Checkout URLs

Query string parameters can be appended to the /_mycart URL to create custom links that add one or multiple products to the cart. You can use these custom links in areas such as:

  • Marketing emails
  • Widgets
  • Live chat

Parameters

Parameter Description Example
addcpn Applies a coupon to a user’s cart. The coupon must be valid in order to be applied. ?addcpn=FREESHIPPING
sku Product SKU to add to the cart. ?sku=TEST_PRODUCT
qty Quantity of product SKU to add to the cart. ?qty=5
multi Add multiple products to a user’s cart. The value of this parameter defines how many different products are added at once. ?multi=2&sku0=TEST_PRODUCT&qty0=1&sku1=OTHER_PRODUCT&qty1=1
fn payment can be used to go directly to checkout. ?fn=payment

Usage

Using the above parameters you can create links in a custom script or in a template file. For example:

<a href=”/_mycart?sku=TEST_PRODUCT” title=”Go to checkout” >Go to checkout with this product</a>

You can also make ajax requests directly to that URL from the webstore. For example:

document
  .getElementById("#myButton")
  .addEventListener("click", async function () {
    try {
      await fetch({
        method: "GET",
        url: "/_mycart?sku=SOME_PRODUCT_SKU",
      });
      window.location = "/_mycart?fn=payment";
    } catch (e) {
      alert("Couldn't add to cart!");
    }
  });

Was this article useful?

Be notified when this page is updated. Optional.