Answer the question
In order to leave comments, you need to log in
How to display custom attribute after product name on shop page in woocommerce?
There is a solution to the problem, but not a complete one.
Add code to functions.php
function my_template_loop_product_title(){
global $product;
echo '<h3 itemprop="name" class="product_title entry-title">';
$versionvalues = get_the_terms( $product->id, 'pa_model');
foreach ( $versionvalues as $versionvalue ) {
echo $versionvalue->name;
}
echo '</h3>';
}
add_action( 'woocommerce_shop_loop_item_title', 'my_template_loop_product_title', 10 );
<?php
$subheadingvalues = get_the_terms( $product->id, 'pa_model');
if ($subheadingvalues): ?>
<b>Название:<b>
<?php foreach ( $subheadingvalues as $subheadingvalue ): ?>
<?php echo $subheadingvalue->name; ?>
<?php endforeach; ?>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
But this code must be inserted in the place where the attribute should be displayed:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question