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

Change displayed product number

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.

Hello,

I'm currently using two snippets that work with my current filter plugin (and others)

displaying a"show all" button after the pagination when products number is over 12

add_action( 'woocommerce_after_shop_loop', 'wpse333192_add_showall', 40 );

function wpse333192_add_showall() {

if(!is_admin()) {
if ( ! isset( $_GET['showall'] ) ) {
global $wp;

global $wp_query;
if($wp_query->found_posts >= 12){
echo sprintf(
"<a class=\"show-all\" href='%s'>%s</a>",
home_url( add_query_arg( array_merge( $_GET, [ 'showall' => 1 ] ), $wp->request ) ),
__( 'Show All','snippet')
);
}
}
}

}

and

displaying all the products of the current query if that button's been clicked

function wpse333192_alter_query_showall( $query ) {

/**
* Alter the query only if it is:
* 1. The main query
* 2. Post type is product
* 3. $_GET['showall'] is set
* 4. $_GET['showall'] equals 1
*/

if ( $query->is_main_query()
&& $query->get( 'post_type' ) == 'product'
&& isset( $_GET['showall'] )
&& $_GET['showall'] == 1
&& !is_admin()
) {
// Load the 'first' page
$query->set( 'paged', 1 );

// Set post per page to unlimited
$query->set( 'posts_per_page', - 1 );
}

return $query;
}

 

My question is : how can I make these snippets work with Husky ? Right now, when I try, the button doesn't appear and adding showall=1 into the url as parameter doesn't work either.
Thank you

Hello

Please drop me exact link to the issue

 wpse333192_alter_query_showall  - Which hook is this function for?

Hello,

sorry, the function is called with this hook : add_action( 'pre_get_posts', 'wpse333192_alter_query_showall' );

You can see the link here :

Spoiler

- without the showall=1 : https://www.amigosskateshop.com/shop-copy/
- with the showall=1 : https://www.amigosskateshop.com/shop-copy/?showall=1
- working example : https://www.amigosskateshop.com/shop/?showall=1 careful it takes time to load (and without the showall=1 so you can see the link appearing at the bottom https://www.amigosskateshop.com/shop/ )

Unfortunately I don't see any relation to my plugin.

You should write to support this third party product template - https://share.pluginus.net/image/i20241017125917.png

 

Hello, sorry about that. That was a bug it has been fixed.
But you just say"I don't see any relation to my plugin" like that even if that's working with other filter plugins but yours ?

Would there be a snippet going with your plugin to display all the products when asked ?

Hello

Our plugin does not affect pagination because it is a filtering plugin.

 like that even if that's working with other filter plugins but yours ?  -  You can simply disable my plugin and nothing will change, your custom code will also not work for this product template

Hello,

But what about this options then ?


And, my snippt works on every pages with or without filter plugin except the page with HUSKY plugin. That might mean that the plugins has an impact on this, doesn't it ?

No! Since there is no filtering, the plugin does not affect

This setting is only for Ajax result or [woof_products] shortcode

Oh ok. Do you have an idea that would help me figure it out ?
Cause, 'woocommerce_after_shop_loop' is just a hook to display thing after the loop, nothing really connected to the pagination itself.
And 'pre_get_posts' is related to the query that get posts. Does the plugin use this hook ? I guess yes since it has to filter the query.
Only when I use the plugin, these don't work. I really thing there's something there, don't you think ?

Hello

I already wrote you my proposal - https://share.pluginus.net/image/i20241021125757.png - Because this third party template may not have these hooks and override 'pre_get_posts'

Hello,

Sorry I thought this was meant for the bug at the moment.
The third party template have the hooks and as I said, it works with others filtering plugins. That's why I think it comes from yours.
The function is called by this hook, is there a way to take the plugin into account in this function ?
Thanks

Hello

Ok! Just turn off my plugin and do a test

Thank you so much ! That was exactly the help I needed. Indeed you're right and I was wrong! It doesn't work on this page even without the plugin.
I'll have a look on that. I'm so sorry for the time it took, but I needed this kind of help to understand this.
I reckon it seems dumb for you, but I needed that exact question to figure it out.
Thank you again

Hello

We always learn something new, that's the whole point

Welcome;)