Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Anand, is ‘menu_order’ a custom field in the product? You could try something like this (you will probably need to load the menu_order separately).

    Hope that helps!

    Thread Starter Anand j

    (@anand_jodawat)

    Yes I saw your previous post related to sku, but that is regrading ordermeta.

    menu_order is not a custom field, its general field when we add woocommerce product we can assign product to desired order. menu_order save in post table.

    Plugin Contributor Ewout

    (@pomegranate)

    Hi Anand,
    In that case I would add the menu_order to the item data using the wpo_wcpdf_order_item_data filter, something like this:

    add_filter( 'wpo_wcpdf_order_item_data', 'wpo_wcpdf_order_regular_price', 10, 2 );
    function wpo_wcpdf_order_regular_price ( $item_data, $order) {
        if (!empty($item_data['product']->post)) {
            $item_data['menu_order'] =$item_data['product']->post->menu_order;
        } else {
            $item_data['menu_order'] = '';
        }
        return $item_data;
    }

    then sorting by that value.

    Hope that helps!

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can we display order items by products's menu_order’ is closed to new replies.