Sort WooCommerce products in cart order by price

Sort Woocommerce Cart Order By Price

By default the WooCommerce cart is ordered by when products are ordered in sequence, this can be manipulated with the woocommerce_cart_loaded_from_session hook. A new array is created $products_in_cart and the carts content is looped with the key of the array being the price $product->get_price(), the array is then sorted with asort or arsort before being…

Read More