Marketing
This guide explains how to build a URL that adds a specific product to the cart with a defined quantity and opens the cart automatically.
🛠 How to Create the URL Parameter for a Product
This guide explains how to build a URL that adds a specific product to the cart with a defined quantity and opens the cart automatically.
1. Gather What You Need
You’ll need the following:
listingId: The product IDvariantId: The specific version of the product (e.g., size, color)quantity: How many of the item to add
2. Create the Item Key
The item key format is:
[listingId].[variantId]
For example:
123.456
3. Package It with Quantity
Create an object that looks like this:
{ "123.456": 2 }This means: "Add 2 of item 123.456 to the cart."
4. Turn It Into a URL
Convert the object to a Base64-encoded string. The final URL format is:
?session=BASE64_STRING&open=true
Example:
?session=eyIxMjMuNDU2IjoyfQ==&open=trueWhen someone clicks this link, the cart will open with the item already added.
✅ Example
Inputs:
listingId:123variantId:456quantity:2
Result:
?session=eyIxMjMuNDU2IjoyfQ==&open=trueThis adds 2 of product 123, variant 456, to the cart and opens it automatically.
Updated 6 months ago
