WooCommerce – Sort shipping options / methods / services by shipment cost

[vc_cta h2=”The Below Code Works for the Following Plugins:”]

[/vc_cta]
WooCommerce doesn’t sort the shipping methods / services by default while showing it on cart and checkout page.

Code Snippet for sorting the shipping options by cost.

Below code snippet will help to sort the shipping options by shipping cost.

Screenshot – Shipping Options – Default view.

WooCommerce Shipping Services

Screenshot – Shipping Options – Sorted view.

WooCommerce Shipping Services Sorted.

 

 

12 thoughts on “WooCommerce – Sort shipping options / methods / services by shipment cost”

  1. This used to work up until we upgraded woocommerce to 3.2.5 and wordpress to 4.9.1 now when something is added to the cart, it returns this error:

    Warning: array_keys() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 478

    Warning: array_keys() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 449

    Warning: current() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 450

    Warning: array_keys() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 478

    Warning: array_keys() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 449

    Warning: current() expects parameter 1 to be array, null given in /home4/ffxbmeus/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 450

    1. Hi Marc,

      We tested this on our side but could not replicate the issue. Would it be possible for you to approach our support team on this so that they can resolve the problem? Here is the URL of support.

    1. One should be careful with this code snippet. It sorts the shipping correctly, however, it causes an error to appear that says “no shipping method has been selected” when clicking the payment button. I’m using the latest version of wordpress (4.6.1) and woocommerce (2.6.6).

    2. Strange. I can’t see the code snippet. I tried 3 different browsers. I see the title and the screenshots, but no code snippet.

Comments are closed.

Scroll to Top