Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
}
}
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment