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', 'remove_email_number', 10, 2); | |
function remove_email_number($args, $order_id) { | |
if(isset($args['shipping_address']['email'])){ | |
unset($args['shipping_address']['email']); | |
} | |
return $args; | |
} |
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) { | |
if( isset( $item_value['sku'] ) ) { | |
$product_id = wc_get_product_id_by_sku( $item_value['sku'] ); | |
if( $product_id ) { | |
$args['items'][ $item_key ]['sku'] = $product_id; | |
} | |
} |
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_price', 10, 2); | |
function modify_item_price($args, $order_id) { | |
if( isset( $args['items'] ) ) { | |
foreach ($args['items'] as $item_key => $item_value) { | |
if( isset( $item_value['item_value'] ) ) { | |
$args['items'][ $item_key ]['item_value'] = round( floatval( $item_value['item_value'] ), 2); | |
} | |
} | |
} | |
return $args; |
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_price', 10, 2); | |
function modify_item_price($args, $order_id) { | |
if( isset( $args['items'] ) ) { | |
foreach ($args['items'] as $item_key => $item_value) { | |
if( $item_value['item_value'] == 0 ) { | |
$args['items'][ $item_key ]['item_value'] = 0.01; | |
} | |
} | |
} | |
return $args; |
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_base_country', 'my_custom_base_country'); | |
function my_custom_base_country( $base_country ) { | |
return '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_label_args', 'custom_shipping_address_no', 10, 2); | |
function custom_shipping_address_no($args, $order_id) { | |
$args['shipping_address']['address_2'] = get_post_meta($order_id, 'my_custom_address_no', true); // Set to your custom address number field, most likely a order meta data | |
return $args; | |
} |
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) { | |
$total_weight += 1; // Add any weight needed, units of measure will be whatever is set in WooCommerce | |
return $total_weight; | |
} |
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
<?php | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
// $file = sanitize_file_name( $_GET['path'] ); | |
// sanitize path | |
$file = realpath( $_GET['path'] ); | |
// echo $file; | |
if ( current_user_can( 'edit_shop_orders' ) && check_admin_referer( 'download-dhl-label' ) ) { |
NewerOlder