I would like to display variable products shipping class set for each variant. I realize that I may need to have a mix of php and Javascript but I would like to get the PHP side right first.
I am guessing the best way to start is to use:
if( $product->is_type( 'simple' ) ) {
$product = wc_get_product();
$shipping_class = $product->get_shipping_class();
} elseif( $product->is_type( 'variable' ) ) {
$product = wc_get_product();
$shipping_class = $product->get_shipping_class();
}
But I am not sure how to get the product variant shipping class or if I am doing this correctly. Looking into wc_get_product_variation
or variation to see if it has the answer.
Any help would be appreciated possibly display all as an array and use javascript to hide the selected.
How do I get the variant shipping class?