Home Forums WoodMart support forum Product sorting by popularity does not work / PLEASE HELP

Product sorting by popularity does not work / PLEASE HELP

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #383850

    albert77
    Participant

    Hello, I’ve been trying to sort products by popularity (number of clicks) for weeks, but it doesn’t work.

    My developer desperately needs your advice:

    ask them that when we try to sort out products using custom meta it is not sorting it

    and let them know that we used this filter by woocommerce woocommerce_get_catalog_ordering_args

    and we used orderby=meta_key and meta_key_num both

    function woo_add_postmeta_ordering_args( $sort_args ) {
    $orderby_value = isset( $_GET[‘orderby’] ) ? wc_clean( $_GET[‘orderby’] ) : apply_filters( ‘woocommerce_default_catalog_orderby’, get_option( ‘woocommerce_default_catalog_orderby’ ) );
    switch($orderby_value){
    case “views”:
    $sort_args[‘meta_key’] = ‘_total_views_count’;
    $sort_args[‘meta_type’] = ‘NUMERIC’;
    $sort_args[‘orderby’] = ‘meta_value_num’;
    $sort_args[‘order’] = ‘desc’;

    echo $orderby_value;
    print_r($sort_args);
    break;
    }
    return $sort_args;
    }
    add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘woo_add_postmeta_ordering_args’ );

    Best Regards

    #383864

    Hello,

    Please make the full backup of your site and check the issue on the Storefront theme to detect if our theme causes the problem. Storefront is a free theme developed by WooСommerce.

    Best Regards

    #383980

    albert77
    Participant

    Thank you we try it

    #384040

    albert77
    Participant

    Hello, I disabled all plugins and used the Storefront theme but sorting by popularity still doesn’t work.

    All other sorting works, like price or newest.

    #384377

    Hello,

    If the sorting does not work on the Storefront it means that WoodMart theme does not cause or influence that.

    Most likely the code you have added is not correct. Our support does not cover the investigation and or fixing the third parties code.

    If you have any questions please feel free to contact us.

    Best Regards

Viewing 5 posts - 1 through 5 (of 5 total)