kh4n605
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Here is the debug messages.
Method settings: Enabled: yes Method Title: Flexible Shipping Method Description: Tax status: None Costs includes tax: no Free Shipping: Free Shipping Label: Free 'Left to free shipping' notice: no Rules Calculation: Sum Cart Calculation: Package value Visibility (Show only for logged in users): no Default: no Debug mode: yes Integration: none Contents value: 145 BDT Contents weight: 50 kg Rule 1: Condition: Weight; min: 25; max: 35; input data: 0; matched: no Rule 2: Condition: Weight; min: 35.1; max: 60; input data: 0; matched: no Used and displayed in the cart/checkout: no
Can you please give me an example of how to filter your hooks so that it uses my calculated weight? Actually, I am not understanding the hooks you refer to.
add_filter('flexible-shipping/condition/contents_weight', 'custom_cart_contents_weight', 10, 1); function custom_cart_contents_weight($contents_weight) { global $total_weight; $contents_weight = $total_weight; return $contents_weight; }
It’s not working.
- This reply was modified 2 years, 3 months ago by kh4n605.
The plugin calculates total weight by summing up all the product’s weight. But I need to figure the total weight by this calculation: heaviest product’s weight + (rest of the products weight) * 0.35 = total weight.
I have made this calculation and got the value successfully. I want the plugin to make conditions with this weight, not the total weight.
I can change WooCommerce total weight by this filter hook –
add_filter('woocommerce_cart_contents_weight', 'custom_cart_contents_weight', 10, 1); function custom_cart_contents_weight($weight) { global $total_weight; $weight = $total_weight; return $weight; }
How to assign this weight to the total weight your plugin applies the condition for?
Viewing 3 replies - 1 through 3 (of 3 total)