• Resolved sansel

    (@cernan-daniel)


    Hi,

    I have added to woo emails this:

    
         echo '<div>Shipping recapitulation:';
    //foreach($order->get_shipping_methods() as $shipping_method ){
        foreach($order->get_items( 'shipping' ) as $shipping_method ){
            echo '<p><strong>Shipping Method ID:</strong> '. $shipping_method->get_method_id().'<br>
            <strong>Shipping Method name:</strong> '. $shipping_method->get_name().'<br>
            <strong>Shipping Method title:</strong> '. $shipping_method->get_method_title().'<br>
            <strong>Shipping Method Total:</strong> '. $shipping_method->get_total().'<br>
            <strong>Shipping Method Total tax:</strong> '. $shipping_method->get_total_tax().'</p><br>';
        }
        echo '</div>';
    

    but in emails of suborders for vendors is shipping not figured, only in emails of full parent order:

    Shipping Method ID: wbs
    Shipping Method name: Package 25 kg
    Shipping Method title: Package 25 kg
    Shipping Method Total: 7.25
    Shipping Method Total tax: 0

    Any help to fix that code?

    Thanx so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @cernan-daniel,

    I see, you are only looping over the parent order. You also need to iterate over all the sub-orders to fetch the sub-orders shipping info. Hope this helps.

    Regards

    Thread Starter sansel

    (@cernan-daniel)

    thanx for your reply, do you can help me how to loop over all the sub-orders… any example of code? thanx so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘unpack shipping cost for suborder’ is closed to new replies.