Variant options on invoice

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #183413
    Andrew Willis
    Participant

    This 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?

    #183418
    Andrew Willis
    Participant

    To 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?

    #183466
    Taha
    Moderator
    Plugin Support

    Hello 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,

    #183467
    Andrew Willis
    Participant

    Thanks 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?

    #183709
    Taha
    Moderator
    Plugin Support

    Hello 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:

    1. Disable the “Replace line breaks” option entirely, or

    2. 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,

    #183717
    Andrew Willis
    Participant

    That’s great Taha – and yes, it seems like that does fix the issue…

    #183799
    Taha
    Moderator
    Plugin Support

    Thank 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,

    #183806
    Andrew Willis
    Participant

    I’ve added a Trustpilot review.  Currently pending, but should be through soon…

    #183846
    Taha
    Moderator
    Plugin Support

    I’ve seen it now, thank you very much.
    We are always here whenever you need us.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.