Direct to Cart Link
The Direct to Cart link is a customisable URL which can be used on any page offering direct-to-cart, or direct-to-checkout product purchases. For Bundle Products the user will always land on the product page where they can configure their bundle and then add to cart.
For example, you can write an article and add Direct to Cart URLs within the text to add any product to their cart, or send them directly to the checkout.
Or, you could add a donation link into an email, which adds the givers’ details and donation amount directly into the checkout (provided those details were known, of course).
URL syntax:
[store domain]{/path}/cart/[product string]?[other-parameters]
e.g. https://example.com/cart/RSK-MC-22:1?type=buy
See It In Action
Direct-to-Checkout
In the below example we are sending a customer directly to the checkout to purchase a product.
Where, RSK-MC-22
is the product code
and 1
is the quantity to purchase, the product string would be RSK-MC-22:1
https://storeconnectdemo.com/cart/RSK-MC-22:1?type=buy
Add-to-Cart
You can add-to-cart using the parameter type=add
without taking the customer to the checkout. This allows them to then continue shopping before going to the checkout.
https://storeconnectdemo.com/cart/RSK-MC-22:1?type=add
Preserve Current Cart
By default, the direct to cart feature clears the cart and adds only the products included in the link. To preserve the existing cart and add to it, add this perameter to your link: preserve=true
https://storeconnectdemo.com/cart/RSK-MC-22:1?type=buy&preserve=true
Variable Pricing
With Variable Pricing enabled in the product’s Price Book you can customise the sell price of the product.
Where, 35000
is the sell price of $350.00
and 4500
would be the sell price of $45.00
.
https://storeconnectdemo.com/cart/RSK-MC-22:1:35000?type=buy
Using a Promotion Code
Embedding a Promotion Code is also possible by adding code=PROMOCODE
to the query of the URL. This is case sensitive and can be done as follows.
https://storeconnectdemo.com/cart/commercial-flat-press-bench:1?type=buy&code=10OFFGYM
Pre-Fill from Existing Contact
To streamline the transaction even further, you can pre-fill all of the details of the customer if they are already a contact in your Salesforce Org. Just specify the sc__sc_id__c
of the contact record with the cid
param.
https://storeconnectdemo.com/cart/RSK-MC-22:1?cid=cfdd8249-c76d-4e91-a008-c3f5e70565a4
Pre-Filled Details without an Existing Contact
If you don’t have the contact already in your Salesforce org to reference, you can still pre-fill any details you may already know of the customer.
Note, you can use fname
for First Name and lname
for Last Name or you can specify name
where the first and lastnames are separated by the first space.
https://storeconnectdemo.com/cart/RSK-MC-22:1?fname=Bob&lname=Smith&email=bobsmith@example.com
An Image Link
Using the customised Buy Button URL, it is easy to add the link to an image.
How It Works
Product String
[sfid or slug or product code]:[quantity]{:[custom price]}
Adding two products, a pair of sneakers and a donation of $50:
sneakers:1,donation-open-ended:1:5000
Other Parameters
type
type
indicates the type of action to perform, either just add to cart, or start the checkout.
Options:
add
adds to cartbuy
adds to cart and starts the checkout (default when no parameter is added)
sneakers:1,donation-open-ended:1:5000?buy=add
return
return
specifies where to send the customer after the action is complete, i.e after added to cart or after checkout is completed.
Options:
true
returns to the referrer url (default when no parameter is added)false
continue with the StoreConnect flow and do not route the customer- anything else is assumed to be a callback url to send the customer to
sneakers:1,donation-open-ended:1:5000?buy=add&return=false
Name and address fields
These are all optional and get saved into the session and used in the checkout if supplied:
name
fname
(first name)lname
(last name)email
phone
street
city
state
country
postcode
sneakers:1,donation-open-ended:1:5000?buy=add&return=false&name=Bob%20Smith
Back to Documentation