Support » Plugin: WooCommerce » Is it possible to change font color of label on based based on it’s value?

  • Resolved lychee128

    (@lychee128)


    Hi,

    Is it possible to change the font color (or other attribute) of a label or element on the Woocommerce shop page based on its value?

    I can use CSS to change the attributes. However, I only want to change the attribute if the value meets a certain condition.

    For example, I have metal rods that vary by length. I can easily change the label attributes so that “LENGTH” is color: red. But I want to only change this label if the value is greater on 100mm.

    Right now, when I change the label’s attribute, I can only change it all the time.

    Please let me know if this isn’t clear.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK

    (@riaanknoetze)

    Hi there,

    Yes, this is definitely possible although you’d need to use more than CSS. Instead, you’d need to look at adding a listener through jQuery/JavaScript on when the value changes (or is loaded) and then either change the underlying CSS directly OR add a classname to the element which links to the styles set in your custom CSS.

    Got it and thanks for the guidance. I’ll take a look into how best to do this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.