Passing custom variables through the checkout URL is similar to having hidden fields to collect data. This information will be associated with the customers order and included in;
- The query-string on a custom success page
- Webhook data
- Zapier data
- API data
In this example, your checkout URL is http://abc.thrivecart.com/example-product/ (you would replace this with the real URL to your product).
Step 1: Specifying the variable(s)
You would need to append the variables to the end of your checkout URL. An example of a variable would look like this:
?passthrough[example_key]=example_value
You could have multiple variable passed through and you would put these together like any other query-string, for example:
?passthrough[example_key]=example_value&passthrough[another_key]=another_value
So adding this to a checkout URL, you’d now have something like;
http://abc.thrivecart.com/example-product/?passthrough[example_key]=example_value
Step 2: Checkout process
As your customer completes their order, this information is passed through and associated in the background with their order information. They won’t have any input or control over these variables.
Step 3: Your success page
When redirecting to a custom success page, you will receive your key and value pairings as query-string variables in the URL. You can then use a script on your site to use these based on your specific needed.
For example, in the above example, you could access them as using the follow PHP in your script.
<?php $example_key = $_GET['example_key']; // In the example, this will be set to 'example_value' ?>
Note, any custom pass through information is not included in the hash used to validate the order.
Embeddable checkouts
You can still use the passthrough functionality on a page where you have embedded a checkout on your site. The same process applies where you can either add the variables to the URL where the cart is embedded OR you can inject and handle this directly within the code of the embeddable cart (similar to how you can automatically apply a coupon using an embeddable cart).
You’d need to add the following to the <div>
for the embeddable cart.
data-thrivecart-querystring="passthrough[example_key]=example_value"
So, a full embed code would look something like this:
<div data-thrivecart-account=“abc” data-thrivecart-tpl="v2" data-thrivecart-product=“1” class="thrivecart-embeddable" data-thrivecart-embeddable="tc-abc-1-QDGLYT" data-thrivecart-querystring="passthrough[example_key]=example_value"></div> <script async src="//tinder.thrivecart.com/embed/v1/thrivecart.js" id="tc-abc-1-QDGLYT"></script>
You or your developer could dynamically generate the content within this script based on your specific requirements and what you’re looking to passthrough as part of the order (if it’s not a fixed value).
As always if you have any questions please don’t hesitate to get in touch with the team – please note that we cannot help with writing custom scripts.