Reputation: 1676
global $product;
$shippingClass = $product->get_shipping_class();
this returns the slug but I need the name how do I do this?
Upvotes: 1
Views: 1655
Reputation: 2011
After $shippingClass
add below lines it will get the name.
$shipp_classname= get_term_by('slug',$shippingClass ,'product_shipping_class');
echo $shipp_classname->name;
So complete code is following.
global $product;
$shippingClass = $product->get_shipping_class();
$shipp_classname= get_term_by('slug',$shippingClass ,'product_shipping_class');
echo $shipp_classname->name;
Upvotes: 5