Table of Contents
Advanced Code Snippets for v2.0
Looking for snippets for version 1.1 or older? You can find all the old snippets available on this page. If you're using version 2.0 and a snippet you require isn't yet available below, get in touch with us.
- Custom Shipping Code - supports custom shipping code in the admin
- Custom Shipping Endpoint - for fetching shipping rates from your own shipping endpoint
- Breaking large shipments into multiple smaller packages - if you ship large weight products, use this snippet to break overweight shipments into smaller packages to return rates
- Dynamically setting the shipping origin point for live rates - for changing the origin point for shipping calculations for the whole order
- Locations Modification - for performing dynamic filtering of the countries and states available in the checkout
- Dynamically setting the shipping box dimensions for live rates - for customising the package dimensions sent to the selected live rate providers for your store
Add To Cart Snippets
- Update product page total price to include option modifiers - to dynamically update your product listings total price as the customer changes options before adding to cart
- Dynamic Terms of Service Link - for changing your terms of service link depending on the selected state or country
- Dynamically Require Phone Number - if you require the customer provide a phone number depending on their shipping country
- Dynamically Require Tax ID - if you require the customer provide a tax id depending on their country
- Upsell modal on the checkout - to allow customers to quickly add additional products at checkout
- Gift Wrapping checkbox on the checkout, or other upsell / add-on items from the checkout
- Adding donations on the checkout, allowing customers to add configurable price donations to cart
- Guest Checkout - to allow guest checkout without requiring the customer to enter an email address
- Prevent Shipping to PO Boxes - for preventing customers from shipping to PO Box addresses
- Setting a Max Length on Checkout Fields - if you need to limit how much text a user can enter in an address field.
- Dynamically blocking checkouts based on custom conditions - such as requiring a total order or quantity.
- Add or remove coupon code based on item in cart - Will add/remove coupon if required item is added to/removed from cart.
- Display a dropdown list with "Other" text box - Will display a dropdown list in the checkout, and will display an extra text box for “Other” input if “Other” is selected.
- Toggle tax exemption status on checkout with a checkbox - if you don't need to have a customer provide a tax ID, but want to allow them to specify that they're tax exempt
- Auto Fill and Hide Purchase Order Field - If you'd like to allow customers to submit orders without supplying payment details (use case: Quote System)
- Add a Message Above the Email Address - If you'd like to show a message to customers at the top of the checkout page
- Add an Empty Cart Button to the Cart and Checkout - Twig/jQuery code to add “Empty Cart” button to the cart/checkout (modify for checkout only)
- Dynamically populate custom checkout field options - Pull options for select, radio or checkbox form fields from an endpoint on your website
- Dynamically validate VAT ID - Uses the Pre-Payment Webhook and Vatlayer to validate VAT ID's
- Conversion Tracking Pixels/Scripts - general information for tracking transaction completions with third party services
- Change the "Continue To" Button Based on Products in Cart - Will allow you to customize the URL and label of the “Continue To” button based on the category (or other conditions).
- Add a link to the web receipt based on item category - Add a link to the web receipt based on the category of items in the order