View Modify order id to order number
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_label_args', 'modify_order_id_to_number', 10, 2); | |
function modify_order_id_to_number($args, $order_id) { | |
$order = wc_get_order( $order_id ); | |
$args['dhl_settings']['dhl_label_ref'] = $order->get_order_number(); | |
return $args; | |
} |
View Weight in DE
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; | |
} | |
} |
View Remove state if does not have at least 2 chars
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_label_args', 'maybe_remove_state', 10, 2); | |
function maybe_remove_state($args, $order_id) { | |
if( isset( $args['shipping_address']['state'] ) && ( strlen( $args['shipping_address']['state'] ) < 2 || strlen( $args['shipping_address']['state'] ) > 20 ) ) { | |
unset($args['shipping_address']['state']); | |
} | |
return $args; | |
} |
View Add Company Name to DPI API Call
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_label_args', 'maybe_add_company', 10, 2); | |
function maybe_add_company($args, $order_id) { | |
if( ! empty( $args['shipping_address']['company'] ) ) { | |
if( ! empty( $args['shipping_address']['address_2'] ) ) { | |
$args['shipping_address']['address_2'] = $args['shipping_address']['address_1'] . ', ' . $args['shipping_address']['address_2']; | |
} else { | |
$args['shipping_address']['address_2'] = $args['shipping_address']['address_1']; | |
} | |
$args['shipping_address']['address_1'] = $args['shipping_address']['company']; | |
} |
View Change customs item description
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_label_args', 'modify_item_sku', 10, 2); | |
function modify_item_sku($args, $order_id) { | |
if( isset( $args['items'] ) ) { | |
foreach ($args['items'] as $item_key => $item_value) { | |
$item_value['item_description'] = "ENTER THE DESCRIPTION YOU WANT"; | |
} | |
} | |
return $args; | |
} |
View Sale of goods for customs
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
// Override DHL Label Export Type, and return "Sale of goods" | |
add_filter( 'pr_shipping_dhl_paket_label_shipment_export_type' , 'custom_dhl_export_type', 10, 1 ); | |
function custom_dhl_export_type($type) { | |
return 'COMMERCIAL_GOODS'; | |
} |
View Faire - Zero ordered item price
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('faire_add_to_order_product', 'faire_product_price_zero'); | |
function faire_product_price_zero( $product ) { | |
$product['item']->price_cents = 0; | |
return $product; | |
} |
View Faire - Suppress currency matching
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
// Suppress faire currency matching | |
add_filter('faire_wc_suppress_currency_matching', 'custom_faire_wc_suppress_currency_matching'); | |
function custom_faire_wc_suppress_currency_matching($bool) { | |
return TRUE; | |
} |
OlderNewer