How to update shipping class programmatically
-
Hello WooCommerce,
Please i’ve been trying to figure out how to update shipping class from using php. i created a form which users can use to create product from their account dashboard, i was able to update all the fields using
update_post_meta( $product_id, '_regular_price', $productPrice_converted );
and i created a custom dropdown field and was able to update the dropdown field usingupdate_post_meta( $product_id, '_list_of_stores', 'custom-order' );
(where custom-order is the value of the select option i want updated).Now when i tried the same thing i did for the dropdown for the shipping class, i wasnt able to update the shipping class.
update_post_meta( $product_id, 'product_shipping_class', 29 );
(where 29 is the ID/value of the shipping class).Is there something i’m doing wrong? why is the shipping not updated when product is created. please help
- The topic ‘How to update shipping class programmatically’ is closed to new replies.