Dynamic SCSS for product page swatches

Highlighted
New Member
1 0 0

Hello,

I'm looking for a spot of help on getting my swatches working. 

On the store some of our products have hundreds of different colours. Currently we display these using tiny images, but its not ideal as it creates too many http requests.
So I've set it up to do Hex colours instead.

In the theme.liquid I have: 

    {% if template contains 'swatches-paints' %}
    {{ 'paintcolours.scss.css' | asset_url | stylesheet_tag }}
    {% elsif template contains 'swatches-markers' %}
    {{ 'pencolours.scss.css' | asset_url | stylesheet_tag }}
    {% endif %}

 

This works fine. Only its not good enough, I would like to use the Accentuate Metafields app to assign a CSS Name field to the products with swatches.

My problem is how do I get the asset_url of the {{ product.metafields.accentuate.cssname }} [All scss.liquid file names match the css name field] into the if statement above?

Or is there a better way of doing this?

Thanks

 

0 Likes