WooCommerce: Display All Single Variations (Shortcode)
By default, the WooCommerce Shop page displays simple, variable, grouped, bundle and other product types. As you know, each variable product is made of one or more “single variations”, and these are only visible in the single product page.
Now, what if you want to display a grid of all “single variations” in a custom page / post? Well, a shortcode can be coded so that you can achieve just that. Enjoy!
PHP Snippet: Show All Single Variations As Simple WooCommerce Products Via a Shortcode
In the example below, I’m showing 24 products per page (posts_per_page) and pagination buttons (woocommerce_pagination) above and below the grid of variations.
This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101
WooCommerce: Display All Products Purchased by User When a WooCommerce customer is logged in, you might want to show them the list of previously purchased products (maybe in a custom “My Account” tab). This is helpful when customers tend to buy the same products over and over again, and therefore you can help them “order again” without having them to search the […]
WooCommerce: Display Out of Stock Products (Shortcode) A client of mine wanted to show out of stock products on a separate page – so I coded a simple shortcode for you all! You can use this shortcode for different goals. For example, you might want to display what products you’ve sold to enhance customer trust / social proof. So let’s see (1) […]
WooCommerce: Recently Viewed Products (Shortcode) Currently, you can use a widget or a block to have the user see the list of products they recently viewed. But for now, let’s create our own shortcode… and let’s take advantage of the existing WooCommerce Toggle Payments By Category Mini-PluginRated 5.00 out of 5 $39.00 Easily toggle payment methods based on product categories […]
WooCommerce: Exclude Category from ‘product_categories’ Shortcode Sometimes solutions are very simple, and you don’t need rocket science to fix your issue! A client of mine needed to hide a category from the Product Categories Shortcode ( BloomerArmada (1) WooCommerce Mini-Plugins (25) ); in fact, there is no parameter that allows you to “exclude” a given product category such as “uncategorized” or […]
WooCommerce: Display Product Reviews @ Custom Page (Shortcode) WooCommerce product reviews shows by default in the “Reviews” tab in the single product page. But what if, like me, you’re using custom sales pages and need to show such reviews elsewhere – by using a shortcode? I’ve spent some time doing this for two Business Bloomer pages, the contact page (beside the request a […]
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli