WordPress filter hook

woocommerce_shortcode_products_query

Defined by WooCommerce and fired by 21 plugins in total, running on 7.2M+ sites between them.

How to use woocommerce_shortcode_products_query

It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_shortcode_products_query', function( $query_args, $attributes, $type ) {
	// Change $query_args here.
	return $query_args;
}, 10, 3 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

21 plugins that fire woocommerce_shortcode_products_query

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/shortcodes/class-wc-shortcode-products.php:237
  2. ShopEngine icon ShopEngine90,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) widgets/shop.php:119
  3. ShopLentor icon ShopLentor80,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/archive_product_render.php:155
  4. DethemeKit for Elementor icon DethemeKit for Elementor30,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) modules/woocommerce/classes/products-renderer.php:118
  5. LA-Studio Element Kit for Elementor icon LA-Studio Element Kit for Elementor10,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/modules/woocommerce/classes/products-renderer.php:233
  6. MAS Brands for WooCommerce icon MAS Brands for WooCommerce10,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name ) includes/class-mas-wc-brands-shortcodes.php:293
  7. Discount Rules and Dynamic Pricing for WooCommerce icon Discount Rules and Dynamic Pricing for WooCommerce9,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, array(), 'products' ) public/class-wccs-public-products-list.php:112
  8. Category AJAX Filter icon Category AJAX Filter6,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, array(), 'products' ) includes/frontend/class-caf-builder-main-query.php:1482
  9. Brands for WooCommerce icon Brands for WooCommerce5,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name ) main.php:285
  10. Responsive Addons for Elementor icon Responsive Addons for Elementor3,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/widgets-manager/modules/woocommerce/classes/class-products-renderer.php:152
  11. WC Builder icon WC Builder1,000+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/archive-product-render.php:114
  12. Products Compare for WooCommerce icon Products Compare for WooCommerce1,000+ installs apply_filters( 'woocommerce_shortcode_products_query', array('post_type' => 'product', 'fields' => 'ids', 'post__in' => $products), array(), 'products' ) templates/new-compare.php:21
  13. MDTF icon MDTF900+ installs apply_filters( 'woocommerce_shortcode_products_query', $args, $atts, "" ) classes/shortcodes.php:651
  14. MAS Elementor icon MAS Elementor800+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) modules/woocommerce/classes/products-renderer.php:166
  15. StoreBuild icon StoreBuild400+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) includes/class-pure-wc-shopbuild-products-shortcode.php:242
  16. core plugin for kitestudio themes icon core plugin for kitestudio themes300+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts ) includes/elements/shortcodes/woocommerce/product-loop.php:200
  17. Stax Addons for WooCommerce and Elementor icon Stax Addons for WooCommerce and Elementor100+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) core/woocommerce/ProductsRenderer.php:121
  18. TABLEiT icon TABLEiT20+ installs apply_filters( 'woocommerce_shortcode_products_query', $query_args, $this->attributes, $this->type ) class-wc-shortcode-product-table.php:1045
  19. X-tra Ordinary WooCommerce Product Carousel and Slider icon X-tra Ordinary WooCommerce Product Carousel and Slider20+ installs apply_filters( 'woocommerce_shortcode_products_query', $args, $atts ) public/class-xox-woo-carousel-public.php:423
  20. Trendmag Toolkit icon Trendmag Toolkit10+ installs apply_filters( 'woocommerce_shortcode_products_query', $args, $atts ) inc/widgets/woocomerce/list-products.php:222
  21. Maxi Woo Ajax Navigation icon Maxi Woo Ajax Navigation10+ installs apply_filters( 'woocommerce_shortcode_products_query', $args, $atts ) public/class-waj-public.php:184

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.