• Resolved gscottthoms

    (@gscottthoms)


    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();
    	}
    
    }
    
    • This topic was modified 2 years, 11 months ago by gscottthoms.
    • This topic was modified 2 years, 11 months ago by gscottthoms.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Thread Starter gscottthoms

    (@gscottthoms)

    I’m not going to try to do this anymore, I went with a workaround.
    Thanks!

    Mirko P.

    (@rainfallnixfig)

    Glad you found a workaround for this! If you’d like to share what you did it can be helpful to others having a similar issue. Thank you 🙂

    If you have any further questions we recommend creating a new thread.

    Cheers.

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.