Wordpress/Woocommerce, how to access current product loop query on category page
P粉322918729
P粉322918729 2024-02-21 13:11:12
0
1
446

In my code, I added some filter parameters with shortcodes in the sidebar. I need to access the current product loop query category from which I can get all attributes of the product in the query loop. Can someone tell me where I can find more information about this?

P粉322918729
P粉322918729

reply all(1)
P粉422227023

You can use a WooCommerce specific hook called woocommerce_product_query or a more WordPress core generic hook called pre_get_posts. Both work very similarly - they allow you to access the current WP_Query object and modify it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template