Posts

Showing posts from December 21, 2018

Custom cart item weight in Woocommerce

Image
1 I am creating products that vary greatly in size and weight. I am not using WooCommerce product variants to help me with this as my products are heavily customized. I am using a third-party plugin to select from many variant options and I plan on checking these options to determine the products weight. The issue is I want to set the product weight before the product is added to the cart. A shipping calculator on the cart will then calculate your shipping based off your cart's total weight (WooCommerce Weight Based Shipping). I have tried 2 WooCommerce hooks pretty extensively to do this with no luck. add_filter( 'woocommerce_add_cart_item_data', 'update_weight_on_add_to_cart', 10, 3); and add_action( 'woocommerce_add_to_cart', 'update_weight_on_add_to_cart', 10, 6 ); I ...