We have products with multiple variants (varHeight). The variant information get passed to the cart successfully and order emails. However, they don't show up on the control panel. How can I get the variant information to show up on the order?

Product page

<select name="purchasableId">
<option value="">Select Height</option>
{% for purchasable in product.variants %}
<option {% if purchasable.stock <= 0 and purchasable.hasUnlimitedStock == false %}disabled {% endif %} 
value="{{ purchasable.id }}">{{ purchasable.varHeight }} - {{ purchasable.price|commerceCurrency(cart.currency) }}</option>
  {% endfor %}

Cart page:

  {% if item.purchasable.product.type.hasVariants %}
      {% switch item.purchasable.product.type %}
        {% case "wallpaper" %}
            <strong>{{ item.description }}</strong><br>
            Height: {{ item.purchasable.varHeight }}
    {% endswitch %}
    {% else %}
        {#  Non variant purchasable  #}
        <strong>{{ item.description }}</strong>
    {% endif %}

1 Answer 1


So if you have a variant attribute that is really a determining part of what the SKU actually is, you should probably consider use a dynamic title to build the variant title.

You can do this in the Product Type settings for that product type. You do this by specifying a twig mini-template - here's an example:

enter image description here

There is also a twig mini template option for the variant's description to be built dynamically, and this is in fact what is shown for the line item in the order details in the control panel. Here's another example:

enter image description here

This surfaces the information quite nicely:

enter image description here

In this case - the left side of the hyphen is the product's title, and to the right is the variant's title, which has been build dynamically from the paperSize attribute of the variant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.