2

Your customColor3a and customColor3b variables will always be defined so you need to check if empty. {% if item.options.customColor3a is defined and item.options.customColor3a is not empty %} | Custom Color 1: {{ item.options.customColor3a }} {% endif %} {% if item.options.customColor3b is defined and item.options.customColor3b is not empty%} | ...


1

Yep so can just create a route in the control panel. See: https://docs.craftcms.com/v3/routing.html You'll see you can use a slug (using the token slug) so that Craft will validate the url actually has a valid slug on the end, or you can just use * and craft will route to this template no matter what is on the end. (I personally prefer to create routes ...


1

You're close. Products themselves aren't Purchasebles. However, Variants of products are. And you can have more than one Variant of a Product. So, we need to get all Variants of a particular Product type and then feed your query: {# get products of a certain type #} {% set productIds = craft.products.type('classes').ids() %} {# get the variants from ...


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: There is also a twig mini template option for ...


1

Depending on context, here's another handy way of clearing the cart for Commerce 2/3 In a template, you can put: {% do cart.setLineItems([]) %} {% do craft.app.elements.saveElement(cart) %} You could e.g. just use a direct link to a template that does that, and in turn re-directs to wherever...if you don't want to muck around with a form.


Only top voted, non community-wiki answers of a minimum length are eligible