Answer the question
In order to leave comments, you need to log in
How to make one of the attributes not displayed in the product map?
Good evening! The product on the site has attributes, you need to make sure that one of the attributes is not displayed in the product map. At the same time, the attribute itself cannot be deleted, since it must remain attached to the products.
<?php if ( $product_attributes ) : ?>
<div class="leftSide">
<div class="sideBarHead">
<div class="h5"><?php _e('О мероприятии', 'traveling-store'); ?></div>
</div>
<div class="infoBlockRows">
<?php
$regionsSlugs = [];
foreach ( $product_attributes as $product_attribute ) : ?>
<span class="productInfoRow">
<span class="productInfoRowLabel">
<?php echo wc_attribute_label($product_attribute->get_name(), $product); ?>
</span>
<span class="productInfoRowValue">
<?php $options = $product_attribute->get_terms();
$options = sort_terms_by_menu_order($options);
$options_count = count( $options );
$i = 0;
foreach ( $options as $option ) {
$i ++;
$separator = '';
if ( $options_count !== $i ) {
$separator = ', ';
}
echo wpm_translate_string( $option->name, $lang = wpm_get_language()) . $separator;
} ?>
</span>
</span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question