Displaing woocommerce atributes with changed value – what function?
-
Hello everyone,
I am using following function to display one of woo-commerce attribute:function get_level () { $level= get_the_terms( $product->id, 'pa_level'); foreach ( $level as $level) { echo $level->name . ' '; } }This code is allowing me to display all value of this attribute, one after each other. But problem is that the value of this attribute in the place where I wanna display it is too long. What function do I have to use to change displayed value for shorter.
For example
If value of 1st attribute is “Level 1” display it as a “L1”
2st “Level 2” show as “L2”
etc..
The topic ‘Displaing woocommerce atributes with changed value – what function?’ is closed to new replies.