WooCommerce search query in decimal format. (3 posts)

  1. hashmoody
    Posted 3 years ago #


    I've been using this awesome WooCommerce plugin since last few projects, worked flawlessly.

    But suddenly in my current project I've been stuck at a point for which I cant find any solution, let me explain:

    I am making a site for loose diamonds & it uses CARAT(s) as its weight unit. Now the problem is I can easily store all values in database, the values are in decimal form, for ex.: 1.5, 2.44, 3.67, etc, etc.

    I am also using a plug-in: http://codecanyon.net/item/woocommerce-ajax-product-filter-wordpress-plugin/4640387

    This plugin allows me to create a slider for the Weight, so the user can easily choose the desired weight & make a search.

    But when I used it & came to know I cannot use the precision to decimal numbers! I asked the developer of the plugin & he replied mentioning that it is a limitation of WooCommerce & WordPress! Here's what he wrote:

    "There is limitation at WordPress Query to filter by decimal numbers, Because WordPress uses longtext data type to store post meta values and casting data as float will cut down numbers."


    Please can anyone out there help me out as the whole project is finished & I'm only stuck at this weight filtering.

    Your help will be really greatly appreciated. Please shed some light on the issue.

    Am looking forward for responses! :)

    Thanks in advance!



  2. Yojance Rabelo
    Posted 3 years ago #

    I had a similar problem with a site I built 2 months ago where I had to sort Game Reviews by their rating and these values where also in decimal form.

    The documentation states that you can use meta_value_num to work with sorting numbers but I was never able to get it working.

    I also searched online for solutions involving meta_value_num but none of the solutions worked for me.

  3. hashmoody
    Posted 3 years ago #

    Yes, so Yojance also has the same problem & I'm sure, there are others as well, who might be stuck in the same situation..

    Can we expect a little help from this community ? Please :)

    Thanks. Looking forward for further responses.


    [No bumping. If it's that urgent, consider hiring someone.]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic