WooCommerce get Shipping Class of product from either the product id or the order after order is completed

Palm to FACE!!!

using the product id…

$_product = get_product(id);

$_product = wc_get_product()

$shipclass = $_product->get_shipping_class();

this returns the products shipping class.

EDIT: as mentioned by Aniruddha get_product is depreciated answer has been updated.

Leave a Comment