Forums › PDF Invoices & Packing Slips Generator for WooCommerce – Support Forum › Variant options on invoice
- Support forum for the PDF Invoices & Packing Slips Generator for WooCommerce.
- This topic has 8 replies, 2 voices, and was last updated 7 months, 1 week ago by
Taha.
-
AuthorPosts
-
April 8, 2026 at 8:48 am #183413
Andrew Willis
ParticipantThis plugin is nearly perfect for us. However, we want to include the product [variant] choices that the customer chose, on their invoice.
I have tried these options, after having seen one of your previous posts on this subject:
[item_meta key=”attribute_pa_frame-style” before=”Frame: ” after=””]
[item_meta key=”pa_frame-style” before=”Frame: ” after=””]
However, neither works – and in fact breaks the invoice layout completely. It seems that in the db our variant attribute is stored as ‘attribute_pa_frame-style’.
Can you suggest anything else for me to try?
April 8, 2026 at 9:02 am #183418Andrew Willis
ParticipantTo add to this, I think it only breaks the invoice layout if there is not a valid attribute choice on that product. So, this seems to work if there is:
[item_meta key=”pa_frame-style” before=”Frame: ” after=””]
How do I wrap this in an if statement, checking to see if there is a valid ‘pa_frame-style’ for that product ordered?
April 9, 2026 at 6:38 am #183466Hello Andrew,
Thank you for reaching out, I would be happy to assist you.
The
[item_meta]shortcode must be used inside the[each_item][/each_item]loop, as shown in the example below:[each_item] [item_meta key="pa_color" before="Color: "] [/each_item]If you would like to use it with a conditional statement, you can do so as follows:
[each_item] [if value1="{item_meta key='pa_color'}" operator="not_equal" value2=""][item_meta key="pa_color" before="Color: "][/if] [/each_item]Note: Please note that there are single quotes (vs. double quotes) in
"{item_meta key='pa_color'}".Let me know if you need further clarification or assistance.
Best regards,
April 9, 2026 at 7:26 am #183467Andrew Willis
ParticipantThanks for the assistance Taha
I have made the changes you suggested, but this still works only on some orders. For others, that whole section of the invoice is blank. So, something must still be throwing it off balance. This is my ‘each_item’ code now:
[each_item]
<table class=”order-items”>
<tbody>
<tr>
<td style=”width: 15%;text-align: center;vertical-align: middle”>[item_product_image]</td>
<td style=”width: 46%”>[item_name]
[if value1="{item_meta key='pa_frame-style'}" operator="not_equal" value2=""][item_meta key=”pa_frame-style” before=”Frame: “][/if]
[if value1="{item_meta key='pa_mount-colour'}" operator="not_equal" value2=""][item_meta key=”pa_mount-colour” before=”Mount: “][/if]
[if value1="{item_meta key='pa_orientation'}" operator="not_equal" value2=""][item_meta key=”pa_orientation” before=”Orientation: “][/if]
</td>
<td style=”width: 12%”>[item_product_sku]</td>
<td class=”qty” style=”width: 7%”>[item_qty]</td>
<td class=”price” style=”width: 10%”>[item_single format=”price”]</td>
<td class=”price” style=”width: 10%”>[item_total format=”price”]</td>
</tr>
</tbody>
</table>
[/each_item]Can you spot anything wrong? I suspect it is on orders where one of the attributes isn’t applicable that it fails?
April 13, 2026 at 8:25 am #183709Hello Andrew,
I am truly sorry for the delay.
The issue is caused by the “HTML content filters > Replace line breaks” option. This setting replaces double line breaks (i.e., two consecutive empty lines) with paragraph elements, which interferes with your HTML structure.
To resolve this, you can either:
-
Disable the “Replace line breaks” option entirely, or
-
Place your shortcodes on the same line and use the
[break]shortcode where you want line breaks.
Here’s an example of the corrected structure:
...<td style="width: 46%">[item_name][if value1="{item_meta key='pa_frame-style'}" operator="not_equal" value2=""][break][item_meta key="pa_frame-style" before="Frame: "][/if][if value1="{item_meta key='pa_mount-colour'}" operator="not_equal" value2=""][break][item_meta key="pa_mount-colour" before="Mount: "][/if][if value1="{item_meta key='pa_orientation'}" operator="not_equal" value2=""][break][item_meta key="pa_orientation" before="Orientation: "][/if]</td>...Please let me know if this resolves the issue.
Best regards,
April 13, 2026 at 8:57 am #183717Andrew Willis
ParticipantThat’s great Taha – and yes, it seems like that does fix the issue…
April 14, 2026 at 12:28 pm #183799Thank you for confirming back, I’m really happy to hear that!
If it’s not too much to ask, could you please spare a minute or two to write a 5 star review, you can do it here or here.
Doing that would be a great “thank you” from you to us, truly.
Have a good day, and as always, we’re here whenever you need us.
Best regards,April 14, 2026 at 2:06 pm #183806Andrew Willis
ParticipantI’ve added a Trustpilot review. Currently pending, but should be through soon…
April 15, 2026 at 5:17 am #183846I’ve seen it now, thank you very much.
We are always here whenever you need us. -
-
AuthorPosts
- You must be logged in to reply to this topic.