P
P
Pavel Bersenev2016-04-26 10:56:59
WordPress
Pavel Bersenev, 2016-04-26 10:56:59

WP - how to display custom product properties in a product category?

I use woocommerce + WP, the plugin disabled the display of the "add to cart" button.
How to display all custom properties under the product name?
Category page example: iso-dom.ru/proekty-foto-i-ceny/bani

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Kozlov, 2016-04-27
@wilelf

I answered a similar question
here

A
Artyom, 2016-04-26
@KubrickHabr

Edit archive.php of your theme or paste archive-
product.php

public function get_attributes() {
        $attributes = array_filter( (array) maybe_unserialize( $this->product_attributes ) );
        $taxonomies = wp_list_pluck( wc_get_attribute_taxonomies(), 'attribute_name' );

        // Check for any attributes which have been removed globally
        foreach ( $attributes as $key => $attribute ) {
            if ( $attribute['is_taxonomy'] ) {
                if ( ! in_array( substr( $attribute['name'], 3 ), $taxonomies ) ) {
                    unset( $attributes[ $key ] );
                }
            }
        }

        return apply_filters( 'woocommerce_get_product_attributes', $attributes );
    }

to the end of the loop <?php woocommerce_product_loop_start(); ?>
By the way, here is a well-written answer to the question How to change the layout of WooCommerce elements in WordPress?

P
Pavel Bersenev, 2016-04-26
@wilelf

Artem, I need to display custom properties (product attributes), and not a short description.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question