This is an old revision of the document!
Table of Contents
Redirect the customer to a webpage instead of showing the Foxy receipt
If you'd like to redirect the customer to a webpage (perhaps a Thank You page on your site), you can use this snippet to do so.
Step 1: Apply the snippet to your configuration
- Copy the following code to your computer's clipboard:
{% if context == "receipt" %}
<script>
window.location.href = "https://your-desired-url-here/";
</script>
{% endif %}
- Go to your Templates configuration in your FoxyCart admin.
- Scroll down until you see custom footer under Add custom header and footer code to your templates. You may see some code already in the box. You can paste the code that you copied to your clipboard into that box.
Step 2: Customise conditions
- If you would like the receipt to redirect to your page only the very first time (after the customer completes their order), you can change the first line of the snippet to
{% if first_receipt_display and context == “receipt” %}. This will show the Foxy receipt to the customer if they click the Receipt link from the email that they receive. - Update the link
the-desired-url-hereto your desired redirect URL. - Scroll down until you see the Update button and click to save.
- You can run a test by going into the Foxy transactions log and click (view) under the transaction id to view the current version of the web receipt.