You are here

avatax-address.html.twig in Drupal Commerce Connector for AvaTax 8

Default template for the 'avatax' address formatter.

Available variables:

  • original.address_line1: First address line.
  • original.address_line2: Second address line.
  • original.postal_code: Postal code.
  • original.locality: Locality name
  • original.administrative_area: Administrative area code.
  • original.country: Country name.
  • original.country_code: Country code.
  • suggestion.address_line1: First address line.
  • suggestion.address_line2: Second address line.
  • suggestion.postal_code: Postal code.
  • suggestion.locality: Locality name
  • suggestion.administrative_area: Administrative area code.
  • suggestion.country: Country name.
  • suggestion.country_code: Country code.
  • fields: list of different fields.

File

templates/avatax-address.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default template for the 'avatax' address formatter.
  5. *
  6. * Available variables:
  7. * - original.address_line1: First address line.
  8. * - original.address_line2: Second address line.
  9. * - original.postal_code: Postal code.
  10. * - original.locality: Locality name
  11. * - original.administrative_area: Administrative area code.
  12. * - original.country: Country name.
  13. * - original.country_code: Country code.
  14. * - suggestion.address_line1: First address line.
  15. * - suggestion.address_line2: Second address line.
  16. * - suggestion.postal_code: Postal code.
  17. * - suggestion.locality: Locality name
  18. * - suggestion.administrative_area: Administrative area code.
  19. * - suggestion.country: Country name.
  20. * - suggestion.country_code: Country code.
  21. * - fields: list of different fields.
  22. *
  23. * @ingroup themeable
  24. */
  25. #}
  26. {% set suggested = suggestion.country_code|length %}
  27. <p class="intro">
  28. {% if suggested %}
  29. {{ 'Your shipping address is different from the post office records. We suggest you accept the recommended address to avoid shipping delays.'|t }}
  30. {% else %}
  31. {{ 'We could not validate the address entered. Please check that you have entered the correct address'|t }}
  32. {% endif %}
  33. </p>
  34. <p>Entered address is:</p>
  35. <p class="address" translate="no">
  36. {% if original.address_line1 %}
  37. <span> {{ original.address_line1 }}</span>,
  38. {% endif %}
  39. {% if original.address_line2 %}
  40. <span>{{ original.address_line2 }}</span>,
  41. {% endif %}
  42. {% if original.locality or original.postal_code or original.administrative_area %}
  43. <span>{{ original.locality }}</span>, <span>{{ original.administrative_area }}</span> <span>{{ original.postal_code }}</span>
  44. {% endif %}
  45. {{ original.country_code }}
  46. </p>
  47. {% if suggested %}
  48. <p><strong>Recommended address is:</strong></p>
  49. <p class="address" translate="no">
  50. {% if suggestion.address_line1 %}
  51. <span class="{{ fields.address_line1 ? 'suggested' : 'original' }}"> {{ suggestion.address_line1 }}</span>,
  52. {% endif %}
  53. {% if suggestion.address_line2 %}
  54. <span class="{{ fields.address_line2 ? 'suggested' : 'original' }}">{{ suggestion.address_line2 }}</span>,
  55. {% endif %}
  56. {% if suggestion.locality or suggestion.postal_code or suggestion.administrative_area %}
  57. <span class="{{ fields.locality ? 'suggested' : 'original' }}">{{ suggestion.locality }}</span>, <span class="{{ fields.administrative_area ? 'suggested' : 'original' }}">{{ suggestion.administrative_area }}</span> <span class="{{ fields.postal_code ? 'suggested' : 'original' }}">{{ suggestion.postal_code }}</span>
  58. {% endif %}
  59. {{ suggestion.country_code }}
  60. </p>
  61. {% endif %}