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.
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 %}
  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 %}
  7.     Duties & taxes included - {tax_amount}.
  8. {% else %}
  9.     No duties & taxes included.
  10. {% endif %}




    • Related Articles

    • 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 ...
    • What is Shipping Option, Method and Service

      Shipping Option — a certain shipping service that the store offers to its customers which is appeared at the checkout with a certain price (rate). The rate of the Shipping Option is calculated according to a certain algorithm that is set up by ...
    • How to set a Carrier shipping option

      Video: How to set a Carrier shipping option in Calcurates You can only add Carrier Shipping Options with those carriers that are connected and which services and packages are synced. So before adding a Carrier as a Shipping Option make sure that: ...
    • How to add Table Rates method

      To add a Table Rates method you should click on "+" icon right above the Shipping Methods grid. The "add method" popup will appear. There are 2 tabs in this popup: Method's general settings Method's algorithm settings General settings Shipping Method ...
    • How to set Table Rates shipping option

      Video: How to Set Up Table Rates Shipping in Calcurates Table Rates features Opposite to Flat Rate, Table Rates (they also call it Matrix Rates) seems to be a more complicated and far more flexible shipping option type. Basically, it helps you to ...