How can I edit the shipping class of a product with code after updating it?
Here's what I have so far on functions.php. It worked with the product_cat term, but it is not working with product_shipping_class.
add_action('save_post_product', 'my_product_save', 10, 3);
function my_product_save( $post_id, $post, $update ) {
$shipping_class_slug = 'international-standard-shipping';
wp_set_object_terms( $post_id, $shipping_class_slug, 'product_shipping_class' );
}
Thanks!