M
M
msdoc112022-04-01 12:36:30
WooCommerce
msdoc11, 2022-04-01 12:36:30

Woo - I can't display product sizes in the card through a loop, how to fix it?

I'm trying to display the sizes of goods through a loop so that each value is wrapped in a tag. But it does not output anything, without a loop everything works

$razmers = $product->get_attribute('Razmer');

foreach( $razmers as $razmer ) {
    echo '<div class="text-white font-medium">'. $razmer .'</div>';
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2022-04-01
@msdoc11

how to fix?
Read documentation.
WC_Product::get_attribute() – Returns a single product attribute as a string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question