In the list of products, it shows five attributes that have individual icons. Two of them have variables, for those variable I want to display other icons. How can I refer to variables to give it another icon?
I have tried to change:
if( $color = $product->get_attribute('pa_color') ){
by this:
if( $color = $product->get_variation_attributes('black') ){
But it gives: Call to undefined method WC_Product_Simple::get_variation_attributes()
The current code is:
add_action('woocommerce_order_action_wc_custom_order_action', 'display_attributes_after_product_loop_title', 15);
function display_attributes_after_product_loop_title(){
global $product;
$output = array(); // Initializing
// The color ()
if( $color = $product->get_attribute('pa_color') ){
// Save the value in the array
$output[] = '<img src="#">';
$output[] = $color;
}
}