Force add Variations to all Product queries

Show Single Variations (SSV) smartly adds variations to all WooCommerce queries like category pages, tag pages, WooCommerce product shortcodes, related products, etc. But if you use a theme that has lots of custom WooCommerce modules, SSV would choose not to add variations to those custom modules by default.

As a solution to this problem, SSV provides a setting to forcefully add variations to all the Product queries on the website (front end only).

When checked, SSV would add variations to all queries that output ‘products’ posts.

How to prevent adding of variations to a specific query?

If you have a custom query where you want to list only the requested products and not all variations, then you can add the iconic_ssv_exclude_variations argument to the list of arguments passed to the WP_Query constructor. Here’s an example:

$args = array(
		'post_type' => 'product',
		'posts_per_page' => 10,
		'iconic_ssv_exclude_variations' => true,
	);

$query = new WP_Query( $args );

WooCommerce Show Single Variations

Display individual product variations of a variable product in your product listings. Make it easy for your customers to view and filter product variations.

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.