Created
January 20, 2021 09:21
-
-
Save shadimanna/188faf758517f50d2967d2eeb8e54ad3 to your computer and use it in GitHub Desktop.
Return flat weight value if Germany shipping destination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('pr_shipping_dhl_order_weight', 'custom_add_weight', 10, 2); | |
function custom_add_weight($total_weight, $order_id) { | |
$order = wc_get_order( $order_id ); | |
if ($order) { | |
$shipping_address = $order->get_address( 'shipping' ); | |
if( $shipping_address['country'] == 'DE' ) { | |
return 30; | |
} | |
} | |
return $total_weight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment