• i have three categories of products: bundled packages; a la carte; additional offerings.
    the order of the products w/in the bundled package appear fine, but i want the pkgs to always show first on the invoice, then the a la carte products (in a certain order), then the additional products (in a certain order).

    is that possible? thx!

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

    (@pomegranate)

    Hi! Are these bundles created with WooCommerce Product Bundles, or just simple products set up to appear as a bundle?
    For the sorting, this is a big difference because when using Product Bundles, internally woocommerce actually registers bundled products the same way as regular products so that simply sorting the products would create a big mess.

    Let me know and I’ll do my best to help!

    Thread Starter mjugarte

    (@mjugarte)

    hi!

    yes, i’m using WooCommerce Product Bundles. the order the products appear in the bundles is fine, because it follows the way it was set up.

    it’s just the items purchase outside of a bundle i want to appear a certain way and i want the bundle (if ordered) to appear 1st on the invoice.

    thx much!

    Plugin Contributor Ewout

    (@pomegranate)

    I’m afraid I can’t help with this as part of free support. Sorting by product name is relatively simple with a small code snippet:

    
    //Sort items by product name
    add_filter( 'wpo_wcpdf_order_items_data', 'wpo_wcpdf_sort_items_by_name', 10, 2 );
    function wpo_wcpdf_sort_items_by_name ( $items, $order ) {
    	usort($items, function( $a, $b ) {
    		return strcmp($a['name'], $b['name']);
    	});
    	return $items;
    }
    

    But as I wrote in my post above this would mix the bundled products with the non-bundles, so that’s undesirable. If you find a developer, they should be able to use that same filter (wpo_wcpdf_order_items_data) to write code for the custom sorting. Hope that helps!

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘sorting products on invoice’ is closed to new replies.