Answer the question
In order to leave comments, you need to log in
How to display the shipping class in the product card?
The night is half the night, and even I can’t sleep .. I can’t help but figure it out, make me think ..
Here the product is individually assigned a delivery class (in the product editor)
How can I display this value in the product map?
Answer the question
In order to leave comments, you need to log in
This value is already used in the shopping cart when choosing a delivery. However, it can be obtained separately, if necessary. The shipping class in WooCommerce is the taxonomy "product_shipping_class". To get it, use the get_terms() function:
$shipping_classes = get_terms( array(
'taxonomy' => 'product_shipping_class',
'hide_empty' => false,
) );
global $product; // Опционально, если продукт у нас не под рукой
$shipping_class = $product->get_shipping_class();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question