I
I
Ismail Osmanov2021-07-20 23:40:19
WordPress
Ismail Osmanov, 2021-07-20 23:40:19

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.
60f732fa570de016628103.png

<?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

1 answer(s)
A
Aricus, 2021-07-21
@Aricus

foreach ( $product_attributes as $product_attribute ) : 
    if ($product_attribute->get_name() !== 'Дни'): ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question