fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Style an attribute label differently if on sale

Hi there,

We are currently using the Pro version of this plugin.

Is there any way to style an attribute label differently when on a product page? We could style it ourselves but I cannot see where to add another data attribute to the variation or how we would go about doing so.

Thanks in advance!

Hakik Zaman

Hi Stephen,

Thanks for reaching out to us. Will you please give me a screenshot so that I can understand it clearly?

BTW, please upload your screenshot here- https://paste.pics/ and post directly the screenshot link in this thread.

Thank you

Hakik Zaman

Hi Stephen,

Unfortunately, you can’t add data-attribute right now.

However, you can add additional CSS selectors using this filter- woo_variation_swatches_variable_item_css_class

I hope it will help.

Thank You

Hi Hakik

Thank you but where would I start with this?

Kind regards

Hakik Zaman

Hi Stephen,

Please check the following snippet as a reference:

add_filter('woo_variation_swatches_variable_item_css_class', function( $get_item_css_classes, $data, $attribute_type, $variation_data){
$get_item_css_classes[] = 'i_am_hakik';
return $get_item_css_classes;
}, 10, 4);

Then you will get a class like this- https://prnt.sc/YtgqR_3_bAbE

I hope it helps.

Thank You

Hakik Zaman

Hi Stephen,

This is the utmost I can do for you.

Rest of the things you have to do yourself or you should hire a developer.

I hope I could clear up your confusion.

Thank You