Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Change the order of free products shown › Reply To: Change the order of free products shown
June 28, 2021 at 8:19 pm #17799
Soft79
Keymaster
Hi,
Sorry for the somewhat late reply.
There’s no out-of-the-box solution for that. It’s possible by using a template override though. You will need some php experience.
First copy wp-content/plugins/woocommerce-auto-added-coupons-pro/templates/coupon-select-free-product.php into wp-content/themes/YOUR-CHILD-THEME/woocommerce-auto-added-coupons/
Then edit this new file. Before the foreach-loop you need to reorder the $form_items-array, for example by using uasort and a custom callback that orders by menu_order. Something like this (untested):
uasort( $form_items, function( $a, $b ) { return $a->getProduct()->get_menu_order() <=> $b->getProduct()->get_menu_order(); } );