В списке продуктов отображаются пять атрибутов, которые имеют отдельные значки.Две из них имеют переменные, для этих переменных я хочу отображать другие значки.Как я могу обратиться к переменным, чтобы дать ему еще один значок?
Я пытался изменить:
if( $color = $product->get_attribute('pa_color') ){
этим:
if( $color = $product->get_variation_attributes('black') ){
Но это дает: Вызов неопределенного метода WC_Product_Simple ::get_variation_attributes ()
Текущий код:
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;
}
}