Title: Sorting attributes numerically
Last modified: November 20, 2019

---

# Sorting attributes numerically

 *  Resolved [lava33](https://wordpress.org/support/users/lava33/)
 * (@lava33)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/sorting-attributes-numerically/)
 * Hi
    Can you please let me know how I can arrange price attributes in numerical
   order.
 * They are currently displayed like this:
    £10, £100, £150, £20, £30, £40, £50,
   £75
 * I want them to display like this:
    £10, £20, £30, £40, £50, £75, £100, £150

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [vpraveen60](https://wordpress.org/support/users/vpraveen60/)
 * (@vpraveen60)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/sorting-attributes-numerically/#post-12155363)
 * Hi
 * We can use usort method here which is Natural order string comparison
 * follow below
 * <?php
    $arr1 = array(“£10″,”£100″,”£150″,”£20″,”£30″,”£40″,”£50″,”£75″);
 * usort($arr1,”strnatcmp”);
 * print_r($arr1);
    ?>
 * output:
 * Array ( [0] => £10 [1] => £20 [2] => £30 [3] => £40 [4] => £50 [5] => £75 [6]
   => £100 [7] => £150 )
 * Thank you
    Praveen Valmiki
 *  [AJ a11n](https://wordpress.org/support/users/amandasjackson/)
 * (@amandasjackson)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/sorting-attributes-numerically/#post-12160274)
 * Hi [@lava33](https://wordpress.org/support/users/lava33/)
 * If I understand correctly, you should be able to use the `Default sort order`**
   name (numeric)** to do this
 * 
    Link to image: [https://cld.wthms.co/5y23jl](https://cld.wthms.co/5y23jl)
 *  [AJ a11n](https://wordpress.org/support/users/amandasjackson/)
 * (@amandasjackson)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/sorting-attributes-numerically/#post-12182257)
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   if you have any further questions, you can start a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sorting attributes numerically’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [AJ a11n](https://wordpress.org/support/users/amandasjackson/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/sorting-attributes-numerically/#post-12182257)
 * Status: resolved