Hi,
Here’s what ChatGPT suggests:
You can achieve this by using a conditional check in your custom design’s Twig template and applying inline CSS (font-style: italic
) if the custom value is set to “Alternative”.
Goal
Make an entire table row italic only if a custom field (e.g. product.custom_value1
) equals "Alternative"
.
Example Twig Code
Let’s say you are manually creating table rows like this in your custom design:
<tr>
<td>{{ product.product_key }}</td>
<td>{{ product.notes }}</td>
<td>{{ product.cost }}</td>
</tr>
You can wrap it in a Twig if
condition with an inline style
:
{% if product.custom_value1 == 'Alternative' %}
<tr style="font-style: italic;">
{% else %}
<tr>
{% endif %}
<td>{{ product.product_key }}</td>
<td>{{ product.notes }}</td>
<td>{{ product.cost }}</td>
</tr>
If You’re Looping Items
If you are looping through line items manually, like this:
{% for product in products %}
<tr>
<td>{{ product.product_key }}</td>
<td>{{ product.notes }}</td>
<td>{{ product.cost }}</td>
</tr>
{% endfor %}
You can modify it like this:
{% for product in products %}
<tr{% if product.custom_value1 == 'Alternative' %} style="font-style: italic;"{% endif %}>
<td>{{ product.product_key }}</td>
<td>{{ product.notes }}</td>
<td>{{ product.cost }}</td>
</tr>
{% endfor %}
Tip: Debug the Field
If it’s not working, output the value to verify:
<td>{{ product.custom_value1 }}</td>
Make sure the value is exactly "Alternative"
(no leading/trailing spaces, correct casing, etc).
Let me know if you want to highlight it differently (e.g. color, background, etc).