Creating direct checkout links
The direct link to checkout allows you to generate a URL that takes customers directly to a checkout cart pre-configured with specific product offerings.
This guide covers an overview of creating a direct link to checkout and steps for implementation.
- Migrated Shopify Checkout Integration
- Shopify Checkout Integration
- Recharge Checkout Integration
Before you start
- Direct checkout links do not preserve items currently in the cart. It will always clear the cart and add the desired product with a quantity of 1 before redirecting automatically to checkout.
- If your product has multiple variants, direct checkout links will default to passing the first variant only.
- Bundles and Collections are not compatible with direct checkout links.
- Previously, the line item attribute
attribution: rc_direct_checkout_link
was automatically added to line items added using a direct checkout link. The line item attribute has been updated to_attribution: rc_direct_checkout_link
which hides the attribute at checkout.
Create a direct link to checkout
When a customer clicks on your direct link, that customer will be redirected to a checkout screen with the specified product pre-populated in their cart and ready for checkout.
Product Subscription Plans
- Click Products and select Products from the dropdown.
- Search and select the specific product you intend to add to the checkout cart.
- Click the more options icon (...) and select Copy checkout link in the Subscription plans section.
- Embed this link anywhere on your site, social media, or marketing outreach.
Legacy product rules
- Click Products and select Products from the dropdown.
- Click the specific product you intend to add to the checkout cart, and navigate to Set order schedule.
- Click Copy direct to checkout link to copy the direct link to your clipboard.
- Embed this link anywhere on your site, social media, or marketing outreach.
Update direct link
The product page in the merchant portal must be refreshed after saving changes such as updating frequency.
To update your product and use the newly generated link:
- Click Products and select Products from the dropdown.
- Search and select the specific product.
- Update the product or plan.
- Save your changes and refresh the page.
- Copy your updated link.
Creating custom checkout links
You can utilize Shopify permalinks to create custom checkout links that target specific products, add multiple products, or add a discount code.
These Shopify permalinks preserve items currently in the cart.
Creating a checkout link to target a specific variant
Update the following link to create a direct link to checkout that targets a specific variant:
https://{SHOP}.myshopify.com/cart/clear?return_to=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26return_to=/checkout
Make sure to update the following:
- Replace
{SHOP}
with your Shopify store URL - Replace
{VARIANT_ID}
with the product variant ID to target a specific variant - Replace
{QUANTITY}
with the number of products to be purchased - Replace
{SELLING_PLAN_ID}
with the selling plan id associated with the selling plan, which defines the terms under which a product is sold
Example
https://bare-supplements.myshopify.com/cart/clear?return_to=/cart/add?items[][id]=12345%26items[][quantity]=3%26items[][selling_plan]=9876%26return_to=/checkout
Creating a checkout link that has multiple products
Update the following link to create a direct link to the checkout that targets multiple products:
https://{SHOP}.myshopify.com/cart/clear?return_to=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26items[][id]={SECOND_VARIANT_ID}%26items[][quantity]={SECOND_QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26return_to=/checkout
Make sure to update the following:
- Replace
{SHOP}
with your Shopify store URL - Replace
{VARIANT_ID}
with the product variant ID to target a specific variant - Replace
{QUANTITY}
with the number of products to be purchased - Replace
{SELLING_PLAN_ID}
with the selling plan id associated with the selling plan, which defines the terms under which a product is sold - Replace
{SECOND_VARIANT_ID}
with the product variant ID to target a second specific variant - Replace
{SECOND_QUANTITY}
with the number of products to be purchased for the second variant ID - Replace
{SELLING_PLAN_ID}
with the selling plan id associated with the second variant ID
Example
https://bare-supplements.myshopify.com/cart/clear?return_to=/cart/add?items[][id]=12345%26items[][quantity]=3%26items[][selling_plan]=9876%26items[][id]=02468%26items[][quantity]=2%26items[][selling_plan]=97531%26return_to=/checkout
Creating a checkout link with a discount code
Update the following link to create a direct link to checkout that adds a discount to a customer's order:
https://{SHOP}.myshopify.com/discount/{DISCOUNT_CODE}/?redirect=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26return_to=/checkout
- Replace
{SHOP}
with your Shopify store URL - Replace
{DISCOUNT_CODE}
with the discount code to be applied at the checkout - Replace
{VARIANT_ID}
with the product variant ID to target a specific variant - Replace
{QUANTITY}
with the number of products to be purchased - Replace
{SELLING_PLAN_ID}
with the selling plan id associated with the selling plan, which defines the terms under which a product is sold
Example
https://bare-supplements.myshopify.com/discount/HALFOFF/?redirect=/cart/add?items[][id]=12345%26items[][quantity]=3%26items[][selling_plan]=9876%26return_to=/checkout
Troubleshooting
If Shopify returns an error (400, 422) when the product is added to the cart, the cause may be:
- Product is out of stock
- Product doesn’t exist in Shopify anymore
- Product is in draft mode
The error is handled by printing the error message on the page and providing a link that returns to your home page. This allows for the customer to continue navigating the site and prevent a dead screen upon error.