How to use Twig-template for method's Explanatory Text?

How to use Twig-template for method's Explanatory Text?

Twig-template allows you to customize method's Explanatory Text depending on the presence of supported variable values such as:
  1. Estimated delivery dates:
    1. "from" - {{delivery_from}}
    2. "to" - {{delivery_to}}
  2. Estimated International duties & taxes - {{tax_amount}}
Allowed tags: if, for.
Filters: default, format_number, replace, round, trim, lower, upper, capitalize, title, date, date_modify.
Learn more about Twig-templates.

Example 1:
If there are estimated delivery dates configured for the shipping method you may set Explanatory Text with variables:
Estimated delivery from {{delivery_from}} to {{delivery_to}}.

If there are no estimated delivery dates configured for the shipping method you may alter Explanatory Text to:
Delivery within 10 business days. 

The Twig-template will be the following:
  1. {% if delivery_from and delivery_to %}
  2.     Estimated delivery from {{delivery_from}} to {{delivery_to}}.
  3. {% else %}
  4.     Delivery within 10 business days.
  5. {% endif %}
Example 2:
If there are estimated international duties & taxes configured for the shipping method you may set Explanatory Text with the variable:
Duties & taxes included - {{tax_amount}.

If there are no estimated international duties & taxes got from the carrier for the shipping method you may alter Explanatory Text to:
No duties & taxes included.

The Twig-template will be the following:
  1. {% if tax_amount is not null %}
  2.     Duties & taxes included - {{tax_amount}}.
  3. {% else %}
  4.     No duties & taxes included.
  5. {% endif %}
You may also combine those variables in a single Twig-template for Explanatory Text:
  1. {% if delivery_from and delivery_to %}
  2.     Estimated delivery from {{delivery_from}} to {{delivery_to}}.
  3. {% else %}
  4.     Delivery within 10 business days.
  5. {% endif %}
  6. {% if tax_amount is not null %}
  7.     Duties & taxes included - {{tax_amount}}.
  8. {% else %}
  9.     No duties & taxes included.
  10. {% endif %}



    • Related Articles

    • Carriers: display real-time carrier rates from certain carriers

      Overview With Calcurates you can display real-time shipping rates and estimated delivery dates from certain carriers we support by connecting your own carrier accounts (UPS, FedEx, USPS, DHL, Canada Post, Australia Post, Aramex / Fastway and more) ...
    • Table Rates: configure own condition-based methods and rates or emulate carrier’s rates

      Overview Table Rates (they also call it Matrix Rates) is the most flexible and powerful shipping option type. It helps you to build a table of multiple methods and rates using a variety of conditions and calculation algorithms. Table Rates consists ...
    • How to set Free Shipping option

      How to Configure Free Shipping in Calcurates? Free Shipping features The Free Shipping option in Calcurates allows you to offer free shipping using customizable conditions, such as specific shipping areas, minimum order subtotal thresholds, and SKU ...
    • How to add or edit a Shipping Option

      Video: How to Set Up Shipping Options in Calcurates Shipping Options can be added and edited from Shipping Options grid. Shipping Options Grid To see Shipping Options grid you should follow Menu > Shipping Options. There are 10 columns in the ...
    • How to set Flat Rate shipping option

      Overview Flat Rate is the simplest and most straightforward shipping option in Calcurates. It provides a consistent shipping rate for all applicable cases, but also includes several flexible calculation methods. By combining Flat Rate with Shipping ...