Targeting Product Attribute Data in 'Thank you' page and 'Workflow'

If we want to control the layout of how the Product Attributes display on the ‘Thank you’ page or in a ‘Workflow’ and we want to include the ‘Name’ of the attribute and ‘Variation’ selected, how would we add this to page? Especially when there are multiple attributes and variations? Not sure how to target specific ones so we could have a nicely laid out format.

Also, is there a way that all attributes could be sent through on a Workflow even if they aren’t selected for that product?

For order data in the confirmation/receipt page and workflow email use the {{order}} object.
https://docs.treepl.co/liquid/order-object#secCheckoutPaymentReceiptWorkflow

So you’d need a few forloops like so:

{% for item in order.items %}
    {{item.name}}
    {% for attr in item.attributes %}
        {{attr.name}}
        {% for option in attr.options %}
            {{option.name}} <!-- YOUR SELECTED ATTRIBUTE/S -->
        {% endfor %}
    {% endfor %}
{% endfor %}

And for listing ALL of a product’s attributes in the workflow, you may be able to use the item_attributes component:
https://docs.treepl.co/component-types/item_attributes
However, I don’t think there is actually any product ID passed through the order object (which is something I’ve submitted for consideration) which you’d need to dynamically populate this component… so might be out of luck there for now… unless you can see another way of getting the product ID.
Hmmm, you might be able to do another product lookup within the order forloop filtering by SKUcode and then pulling the ID from that :frowning:

This is great @Adam.Wilson . So with the forloops, would this list all attributes at once or would you need to target these one at a time? What type of liquid code would you implement here - {{this.name}}?

@Adam.Wilson do you know if the {{order}} is working on Workflows yet? It is documented but last I heard it wasn’t working yet.

Yes, it was listed as a bug fix in release 5.1:

It should list all selected attributes that are saved to that order/product line item.

Within each forloop you’d generally use the variable defined for that loop of data. eg:


but you can also use higher variables in lower loops, and parent this objects inside any loop… just to complicate things :slight_smile:

Thanks for the confirmation @Adam.Wilson