Чтобы вывести свободные атрибуты товара в карточке товара сразу после краткого описания, добавляем данный код в файл funсtions.php Вашет темы Вордпресс.
function display_product_attributes_after_short_description() {
global $product;
// Проверяем, является ли текущая страница страницей товара WooCommerce
if ( is_product() && $product ) {
// Получаем атрибуты товара
$attributes = $product->get_attributes();
if ( ! empty( $attributes ) ) {
echo '<div class="product-attributes">';
foreach ( $attributes as $attribute ) {
// Выводим только те атрибуты, которые имеют видимость после краткого описания
if ( $attribute->get_visible() ) {
// Выводим название атрибута
echo '<div class="diattributes"><strong>' . wc_attribute_label( $attribute->get_name() ) . ':</strong> ';
// Выводим значение атрибута
echo $product->get_attribute( $attribute->get_name() );
echo '</div>';
}
}
echo '</div>';
}
}
}
add_action( 'woocommerce_single_product_summary', 'display_product_attributes_after_short_description', 95 );




