Problems with attributes in Woocommerce 3.4.2 in applying filters

enter image description here

I’m working on a WordPress version 4.9.6 project where I import products with common attributes, and the same attribute appears on the front end for different products with some taxonomy defects and others remain correct. I verified that there is a filter that makes the changes, the position of the filter is in different places caused the error. Unfortunately I can not fix it. Please, do any of the ladies have the solution? I believe the file that matches the problem is: product-attributes.php. I use the most current versions at the moment to meet all your requirements. PHP 7.2.5

<?php
/**
 * Product attributes
 *
 * @version     3.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<table class="table table-striped shop_attributes">
    <?php if ( $display_dimensions && $product->has_weight() ) : ?>
        <tr>
            <th><?php _e( 'Weight', 'porto' ) ?></th>
            <td class="product_weight"><?php echo esc_html( wc_format_weight( $product->get_weight() ) ); ?></td>
        </tr>
    <?php endif; ?>

    <?php if ( $display_dimensions && $product->has_dimensions() ) : ?>
        <tr>
            <th><?php _e( 'Dimensions', 'porto' ) ?></th>
            <td class="product_dimensions"><?php echo esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ); ?></td>
        </tr>
    <?php endif; ?>

    <?php foreach ( $attributes as $attribute ) : ?>
        <tr>
            <th><?php echo wc_attribute_label( $attribute->get_name() ); ?></th>
            <td><?php
                $values = array();

                if ( $attribute->is_taxonomy() ) {
                    $attribute_taxonomy = $attribute->get_taxonomy_object();
                    $attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );

                    foreach ( $attribute_values as $attribute_value ) {
                        $value_name = esc_html( $attribute_value->name );

                        if ( $attribute_taxonomy->attribute_public ) {
                            $values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $value_name . '</a>';
                        } else {
                            $values[] = $value_name;
                        }
                    }
                } else {
                    $values = $attribute->get_options();

                    foreach ( $values as &$value ) {
                        $value = make_clickable( esc_html( $value ) );
                    }
                }

                echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
            ?></td>
        </tr>
    <?php endforeach; ?>
</table>

</tr><tr><td class="label"><label for="pa_impressao">Impressão</label></td><td class="value"><ul class="filter-item-list" name="attribute_pa_impressao"><li><a href="#" class="filter-item" data-value="frente-e-verso">Frente e Verso</a></li><li><a href="#" class="filter-item" data-value="so-frente">Só Frente</a></li><li><a href="#" class="filter-item" data-value="tons-de-cinza-no-verso">Tons de Cinza no Verso</a></li></ul><select id="pa_impressao" class="" name="attribute_pa_impressao" data-attribute_name="attribute_pa_impressao" data-show_option_none="yes"><option value=""></option><option value="frente-e-verso">Frente e Verso</option><option value="so-frente" selected="selected">Só Frente</option><option value="tons-de-cinza-no-verso">Tons de Cinza no Verso</option></select>   </td></tr><tr><td class="label"><label for="pa_impressao">Impressão</label></td><td class="value"><ul class="filter-item-list" name="attribute_pa_impressao"><li><a href="#" data-value="frente-e-verso" class="filter-item">Frente%20e%20Verso</a></li><li class="active"><a href="#" data-value="so-frente" class="filter-item">S%F3%20frente</a></li></ul><select id="pa_impressao" class="" name="attribute_pa_impressao" data-attribute_name="attribute_pa_impressao" data-show_option_none="yes"><option value=""></option><option value="frente-e-verso" class="attached enabled">Frente e Verso</option><option value="so-frente" class="attached enabled">Só Frente</option></select><a class="reset_variations" href="#">Limpar</a></td:</tr>

Read more here:: Problems with attributes in Woocommerce 3.4.2 in applying filters

Leave a Reply

Your email address will not be published. Required fields are marked *