This is an old revision of the document!
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
Put this javascript in the header of your checkout template. You may want to put it in the code injection section of the admin configuation settings.
<script type="text/javascript"> function setTermsLink() { if (FC.json.context != "checkout") return; //Billing or Shipping Region or Country? //string_to_check = FC.json.shipping_address.country; //string_to_check = FC.json.billing_address.region; 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.checkout.renderAdditionalFields(); } FC.client.on("customer-address-change", setTermsLink); FC.client.on("ready", setTermsLink); </script>