Create cart permalinks
You can create cart permalinks to direct customers to Shopify checkouts or the online store cart, with pre-loaded items. You can append query parameters to the cart permalink URL to include additional information and attribute an order to your sales channel.
What you'll learn
Anchor link to section titled "What you'll learn"In this tutorial, you'll learn how to do the following tasks:
- Create cart permalinks
- Modify the checkout
- Attribute an order to your sales channel
- Apply discounts
- Add conversion tracking information
- Redirect customers to the Online Store cart instead of checkout
You have a sales channel app from which you want to link directly to a merchant's checkout or their online store cart. You want your link to pre-load the cart with two specific products.
Step 1: Create a cart permalink
Anchor link to section titled "Step 1: Create a cart permalink"Add product variant IDs and quantities to the shop URL.
The following example adds one each of two products to the cart by specifying the product variant IDs (70881412
and 70881382
) with a quantity of one (1
):
Step 2: Modify the checkout (Optional)
Anchor link to section titled "Step 2: Modify the checkout (Optional)"You can append checkout
query parameters to the cart permalink URL.
The following example includes [email]
and [shipping_address]
as the checkout fields. [shipping_address]
[city]
shows how you can use nesting to populate child fields.
Supported checkout parameters
Anchor link to section titled "Supported checkout parameters"Checkout parameter | Description |
---|---|
checkout[email] |
The email of the customer making the checkout |
checkout[shipping_address][first_name] |
The first name field for the shipping address |
checkout[shipping_address][last_name] |
The last name field for the shipping address |
checkout[shipping_address][address1] |
The address 1 field for the shipping address |
checkout[shipping_address][address2] |
The address 2 field for the shipping address |
checkout[shipping_address][city] |
The city field for the shipping address |
checkout[shipping_address][province] |
The province field for the shipping address |
checkout[shipping_address][country] |
The country field for the shipping address |
checkout[shipping_address][zip] |
The postal code field for the shipping address |
Step 3: Attribute an order to a sales channel (Optional)
Anchor link to section titled "Step 3: Attribute an order to a sales channel (Optional)"To attribute an order to a sales channel, you can add a storefront access token as an additional parameter to the permalink. Merchants can view sales attributions in the Sales by Channel report, which shows the name of the channel that the customer used to place the order. Sales attributions also appear on the sidebar in the Shopify admin.
You can specify a storefront access token in the cart permalink as shown in the following example:
Step 4: Apply discounts (Optional)
Anchor link to section titled "Step 4: Apply discounts (Optional)"You can append a discount
query parameter to apply discounts in the cart permalink URL, as shown in the following example:
You can also append multiple discounts in the cart permalink URL, separated by a comma ,
:
Step 5: Add conversion tracking information (Optional)
Anchor link to section titled "Step 5: Add conversion tracking information (Optional)"If you want to add conversion tracking information, then you can append one of the following query parameters to the cart permalink:
note
attributes
ref
You can add multiple attributes
parameters. note
and attributes
parameters will display in the Notes section on the order details page. The ref
parameter will display as a referral code in the Conversion summary section on the details page.
Step 6: Redirect to the Online Store cart instead of checkout (Optional)
Anchor link to section titled "Step 6: Redirect to the Online Store cart instead of checkout (Optional)"If you want the cart permalink to redirect customers to the Online Store cart instead of the checkout page, then you can append the storefront
query parameter in the cart permalink URL: