Show shipping method title under product name in admin order view
-
I’ve got this far, but I don’t know how to actually print out the shipping method that corresponds with the order item variable ($item) here. I don’t want to get that info from the product variable because there can be multiple shipping method choices per product.
add_action('woocommerce_after_order_itemmeta','woocommerce_before_order_itemmeta',10,3); function woocommerce_before_order_itemmeta($item_id, $item, $product){ $order = $item->get_order(); foreach( $order->get_items( 'shipping' ) as $shipping_id => $shipping_item ){ $order_item_name = $shipping_item->get_name(); $order_item_type = $shipping_item->get_type(); $shipping_method_title = $shipping_item->get_method_title(); $shipping_method_id = $shipping_item->get_method_id(); // The method ID $shipping_method_instance_id = $shipping_item->get_instance_id(); // The instance ID $shipping_method_total = $shipping_item->get_total(); $shipping_method_total_tax = $shipping_item->get_total_tax(); $shipping_method_taxes = $shipping_item->get_taxes(); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show shipping method title under product name in admin order view’ is closed to new replies.