Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/storefront/cart-checkout/guide/add-to-cart-url.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ URLs constructed with these parameters allow you to:
* Add a specific product or SKU to the cart
* Add a specific SKU to the cart and go directly to checkout.

<Callout type="info">
**Consider Checkout URLs for direct checkout workflows:** If your primary goal is to load the checkout directly with products, [Checkout URLs](/docs/storefront/cart-checkout/checkout-url) are typically a better solution. Unlike Add to Cart URLs, Checkout URLs support adding multiple products in a single URL and provide a more streamlined checkout experience.
</Callout>

## Parameters

| **Type**| **Parameter** | **Description** | **Example** |
Expand Down Expand Up @@ -49,6 +53,10 @@ Once constructed, a URL can be inserted directly as text or as an HTML link:

The `sku` and `product_id` parameters accept a single value; you can only use the first value of a comma-separated list of values. In other words, only one product can be added for each request made to an add to cart URL. However, it's possible to combine several HTTP requests into a single button click using front-end JavaScript, as long as your code waits to receive the response of your first request before it makes a second.

<Callout type="info">
**For multiple products:** [Checkout URLs](/docs/storefront/cart-checkout/checkout-url) natively support adding multiple products in a single URL without requiring JavaScript workarounds.
</Callout>

The following gives a very basic example using jQuery. You can also use async/await syntax to make a series of calls from within a `for` loop.

```html showLineNumbers copy
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.