Support » Plugin: WooCommerce » Woocommerce sort by price low to high variation issue

  • Resolved voao

    (@voao)


    issue: When selecting the sorting options in Woocommerce -> Settings -> Display -> Default Product sorting -> Sort By Price (ASC), there is problem with all the variation products.

    It sorts via the variable’s product’s highest price and not taking into account the products lowest price so the sorting looks out of sync and users won’t know this.

    Is there a way to sort the products low to high and use the variable products lowest price when sorting and not the highest price?

    link: https://www.wanderercider.com/shop/?orderby=price

    system report:

    
    ### WordPress Environment ###
    
    Home URL: https://www.wanderercider.com
    Site URL: https://www.wanderercider.com
    WC Version: 2.6.14
    Log Directory Writable: ✔
    WP Version: 4.7.3
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_GB
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: ❌ 5.4.45 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version
    PHP Post Max Size: 1 GB
    PHP Time Limit: 300
    PHP Max Input Vars: 1000
    cURL Version: 7.48.0
    OpenSSL/1.0.1e
    
    SUHOSIN Installed: –
    MySQL Version: ❌ 5.5.51 - We recommend a minimum MySQL version of 5.6. See: WordPress Requirements
    Max Upload Size: 1 GB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 2.6.14
    : 
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    woocommerce_shipping_zones: ✔
    woocommerce_shipping_zone_locations: ✔
    woocommerce_shipping_zone_methods: ✔
    woocommerce_payment_tokens: ✔
    woocommerce_payment_tokenmeta: ✔
    MaxMind GeoIP Database: ✔
    
    ### Active Plugins (13) ###
    
    Code Snippets: by Shea Bunge – 2.8.2
    Disable WooCommerce Reviews: by pipdig – 1.1
    Excel Like Price Change for WooCommerce and WP E-commerce - Light: by Holest Engineering – 2.1.3
    Password Strength for WooCommerce: by Potent Plugins – 1.0.1
    Resize Image After Upload: by iamphilrae – 1.7.2
    SSL Insecure Content Fixer: by WebAware – 2.2.3
    WooCommerce Advanced Free Shipping: by Jeroen Sormani – 1.1.0
    WooCommerce Customizer: by SkyVerge – 2.3.1
    WooCommerce PayPal Express Checkout Gateway: by Automattic – 1.1.2
    WooCommerce My Account Widget: by Bart Pluijms – 0.5.0
    WooCommerce PDF Invoices & Packing Slips: by Ewout Fernhout – 1.5.39
    Woocommerce Products Per Page: by Jeroen Sormani – 1.2.2
    WooCommerce: by WooThemes – 2.6.14
    
    ### Settings ###
    
    Force SSL: ✔
    Currency: HKD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    
    ### API ###
    
    API Enabled: ✔
    
    ### WC Pages ###
    
    Shop Base: #5 - /shop/
    Basket: #6 - /cart/
    Checkout: #7 - /checkout/
    My Account: #8 - /my-account/
    
    ### Taxonomies ###
    
    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    ### Theme ###
    
    Name: Square
    Version: 1.3.4
    Author URL: https://hashthemes.com
    Child Theme: ❌ – If you're modifying WooCommerce on a parent theme you didn't build personally
    then we recommend using a child theme. See: How to create a child theme
    
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: square/woocommerce/single-product-reviews.php
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • I have the same problem on my woocommerce, so I was check my database and found a weird data.

    mysql> select * from wp_postmeta where meta_key = ‘_price’ and post_id = ‘680’;
    +———+———+———-+————+
    | meta_id | post_id | meta_key | meta_value |
    +———+———+———-+————+
    | 11958 | 680 | _price | 246 |
    | 11959 | 680 | _price | 623 |
    +———+———+———-+————+

    For some reason that idk ,It have 2 “__price” entries for one product. Since I didn’t have so much time to solve that bug by now. I just removed the highest __price meta and It works now.

    BUT, I’ll keep searching the reason for product have 2 “__price” entries.

    I found the explanation for 2 _price postmeta:
    https://github.com/woocommerce/woocommerce/issues/12997
    Represents min-max price range of product variations

    Related wc code:
    https://github.com/woocommerce/woocommerce/blob/master/includes/widgets/class-wc-widget-price-filter.php#L160

    Updating the product usually fix the problem(using the save on individual edit page, quick edit don’t works)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce sort by price low to high variation issue’ is closed to new replies.