• Resolved Nicolas Bernier

    (@nicolasbernier)


    Hi

    I have an order ID. I want to find get the packages of the order and which items are included in each package.

    For example, my order has 3 items and 2 packages. One of the 2 packages contains 2 items and the other one has 1 item.

    I have this WC_Order instance
    $order = new WC_Order( $orderId );

    I can get the packages using the get_shipping_methods method
    $order->get_shipping_methods()

    I can get the items of the order the same way with get_items
    $order->get_items()

    But there is no information between the items and the shipping methods.

    I’m currently developing a shipping method plugin. Does my plugin has to do the job while saving the order or is there a standard way to do this ?

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    2.6 will be introducing shipping meta data and will offer a way to list what products shipped with what method. It’s not possible right now.

    Thread Starter Nicolas Bernier

    (@nicolasbernier)

    OK thanks.

    I’ll do it using my own way using the woocommerce_add_shipping_order_item hook

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to find out which item belong to which package (shipping)’ is closed to new replies.