B
B
Boris Belov2015-11-04 22:33:18
WordPress
Boris Belov, 2015-11-04 22:33:18

How to display a specific attribute of a product in a catalog in woocommerce?

Good evening.
There is a task to implement on the wokomertz, in the catalog, the output of product sizes, as here
. Of course, I can take the stupid code from the product-attributes.php file, but then everything will be displayed.
And I only need size . Substitute size here

if ( empty( $attribute['is_visible'] ) || ( $attribute['is_taxonomy'] && ! taxonomy_exists( $attribute['name'] ) ) ) {
      continue;
    } else {
      $has_row = true;
    }
    ?>
    <tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
      <th><?php echo wc_attribute_label( $attribute['name'] ); ?></th>

And nothing comes out.
I will be glad to help.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2015-11-05
@iborisbelov

wp-panda.com/woocommerce_posts/display-product-dim...

global $product;
  $dimensions = $product->get_dimensions();

P
Philipp_off, 2017-06-25
@Filipp_off

Here is a fairly detailed description for displaying attributes in the catalog or on the product page:
webreason.ru/vyvod-atributov-tovara-woocommerce

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question