Problem/Motivation

Tracking information: prints from commerce-shipment-confirmation.html.twig even when there is no tracking code.

It is parented under an attempt to check if the tracking code is not empty:

        {% if (tracking_code) %}
          {% block tracking_info %}
            <tr>
              <td style="font-weight: bold; padding-top:15px; padding-bottom: 15px; text-align: left; vertical-align: top; border-top: 1px solid #cccccc">
                {{ 'Tracking information:'|t }}

https://git.drupalcode.org/project/commerce_shipping/-/blob/8.x-2.x/temp...

I'm guessing the reason that checking the variable tracking_code doesn't work is because it is checking the view mode, rather than the entity's field itself.
https://git.drupalcode.org/project/commerce_shipping/-/blob/8.x-2.x/src/...

Checking the tracking_code itself directly off the entity, and explicitly checking that it's not empty works. {% if shipment_entity.tracking_code is not empty %}

Also, we shouldn't only thank people for their order if it has a tracking code.
https://git.drupalcode.org/project/commerce_shipping/-/blob/8.x-2.x/temp...

Steps to reproduce

Send an email with no tracking code.

Proposed resolution

Fix it.

CommentFileSizeAuthor
#2 3265283-2.patch1.24 KBtonytheferg
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tonytheferg created an issue. See original summary.

tonytheferg’s picture

Status: Active » Needs review
FileSize
1.24 KB
4kant’s picture

Thanks - that worked for me!

jsacksick’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.