PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Issue with using the code given for making page builders and Custom templates filterable

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hey there,

Thanks for a great plugin.

I need your help with something please. I needed to use your given code for the following;

To make custom template compatible with WOOF add next code to the current WordPress child-theme file functions.php:

//Make the Husky product filter work with page builder layouts 
add_action('pre_get_posts', function ($query) {
    if (is_object($query) AND isset($query->query['post_type'])) {
        if ($query->query['post_type'] === 'product' /* AND is_page(1867) */) {
            if (isset($query->query['wc_query']) AND 'product_query' == $query->query['wc_query']) {
                return $query;
            }
            
            global $WOOF;
            if (is_object($WOOF) AND !empty(woof()->get_request_data())) {
                woof()->woof_products_ids_prediction(true);
                $query->query_vars['post__in'] = $_REQUEST['woof_wp_query_ids'];
            }
        }
    }

    return $query;
});

The issue I am having is that when I have this code active in my child themes functions php file (it works like a charm by the way!), but it creates an issue with showing my product list display in the backend. It only shows me 10 products of 600+ and when I comment out this code, it then shows me the entire 600+ products again. I have it set to show 100 products per page but only shows me 10 in total. Any thoughts on this?   Screenshot: https://asset.cloudinary.com/sargef38/6d2d90cb0d8b5cef616a5b0fe219308d

Thank you

Nevermind, sorry for bothering you. I was able to fix it by using the AND !is_admin() within the query.

//Make the Husky product filter work with page builder layouts
add_action('pre_get_posts', function ($query) {
    if (is_object($query) AND isset($query->query['post_type'])) {
        if ($query->query['post_type'] === 'product' AND !is_admin() ) {
            if (isset($query->query['wc_query']) AND 'product_query' == $query->query['wc_query']) {
                return $query;
            }
            global $WOOF;
            if (is_object($WOOF) AND !empty(woof()->get_request_data())) {
                woof()->woof_products_ids_prediction(true);
                $query->query_vars['post__in'] = $_REQUEST['woof_wp_query_ids'];
            }
        }
    }
    return $query;
});

Hello

Ok!  Great!  thank you for your cooperation