Why is product information missing in line items on the wholesale side?

I’m trying to customize our invoices using Order Printer scripting.

We have a mirror site on which the script works perfectly but for some reason, on the wholesale side, there is no product information available for line items.

Relevant section of working script:

    {% for line_item in line_items %}
      <tr>
        <td>
            {{ line_item.product.metafields.field_name.value }}
        </td>
      </tr>
    {% endfor %}

The same script on the wholesale side has access to all other parts of the line_item variable but has no product information at all - printing just the {{ line_item.product }} will not even produce a dump.

I’ve been trying all day to debug this but I can’t make sense of it.

Has anyone encountered this before or have any insights as to what I might be missing?

One thing to check is if the wholesale side has any customizations or modifications that could be affecting the passing of this information. It may also be helpful to compare the code for the line items on the working mirror site and the wholesale site to see if there are any differences.

Another possibility is that the product information may not be available for the line items on the wholesale side due to the specific configuration of the wholesale site’s products and inventory.