Set Default Shipping Class For All Products

It might be laborious and time-consuming to manually assign a shipping class to every products. Default product shipping classes come in handy in this situation! This coding tutorial will walk you through setting the default shipping class in WooCommerce for your products so you don’t have to go to the admin page and select a shipping class choice.

add_filter( 'woocommerce_product_get_shipping_class_id', 'clikresults_default_product_shipping_class', 9999, 2 );
function clikresults_default_product_shipping_class( $value, $product ) {
   $value = $value ? $value : id; // default to shipping class ID = id - please replace with proper id number
   return $value;