Support » Plugin: WooCommerce Random Product Sorting with Pagination » Your plugin working with WOOF product filter

  • Morphim


    Hi there. I did email you but I’ve hopefully worked this out.

    To be used in conjunction with this plugin:
    WOOF for short, which provides an excellent customizable product filtering system. However, WOOF has it’s own random order so this plugins functionality is bypassed.
    So, to get WOOF to also use the functionality of this plugin add:

    case 'random_order':

    to the index.php file of WOOF plugin (**remember this will be overwritten in any update. Also, I’m using the paid version of WOOF but think it should work for the free version too)
    Around line 1882, like this:

     switch ($orderby) {
    			case 'random_order':
                case 'price-desc':
                    $orderby = "meta_value_num {$wpdb->posts}.ID";
                    $order = 'DESC';
                    $meta_key = '_price';

    Then, within the WOOF shortcode on your page, add something like this:
    [woof is_ajax=1 taxonomies=product_cat:96]
    [woof_products taxonomies=product_cat:96 orderby=random_order per_page=24 ]

    This will only display category 96 (or whatever cat number(s) you specify.
    Then the woof_products shortcode fetches the random order set by this plugin and only displays 24 products per page. So, the same random seed is used for any subsequent paginated pages. After an hour, the randomness will change on all pages, after refresh, for another hour.

    Hope this helps someone else : )

  • The topic ‘Your plugin working with WOOF product filter’ is closed to new replies.