Dynamic Terms of Service Link
The following functionality allows you to customize the terms of service link based on the states or countries selected by the user.
Add Javascript
Paste the following into the “footer” textarea of the “Add custom header and footer code to your templates” option, found on the “configuration” page in your store's Foxy administration.
{% if context == "checkout" %} <script> function setTermsLink() { //Billing or Shipping Region or Country? //var string_to_check = FC.json.shipping_address.country; //var string_to_check = FC.json.billing_address.region; var string_to_check = FC.json.shipping_address.region; switch (string_to_check) { case "ID": url = "http://link-id.com"; break; case "WA": url = "http://link-wa.com"; break; default: url = "http://link-default.com"; } FC.json.config.template_config.tos_checkbox_settings.url = url; FC.Template("checkout").clearOutput(); FC.checkout.renderAdditionalFields(); } FC.client.on("customer-address-change.done", setTermsLink); FC.client.on("ready.done", setTermsLink); </script> {% endif %}