WooCommerce: Show In Stock Products First @ Shop

We’ve already seen how to add a custom “Product Sorting” option to the “Default Sorting” dropdown in the Shop page.

The task I was presented with, however, was to display items based on a custom “meta key”. Now, if you have no idea what a “meta key” is, don’t worry too much. For example, “stock status” is one of these keys, and therefore you can sort products by that.

Anyway, let’s abandon the Japanese for now (hey, unless you speak Japanese!) and get into the coding – as usual, simply copy/paste this little plugin in your functions.php and you’ll get the wanted result ๐Ÿ™‚ Continue reading WooCommerce: Show In Stock Products First @ Shop

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) how to create a shortcode and (2) how to take advantage of the existing [products] WooCommerce shortcode and its “ids” parameter to pass just those product IDs that are out of stock!

Continue reading WooCommerce: Display Out of Stock Products (Shortcode)

WooCommerce: Display Stock Status/Quantity @ Shop Page

In this tutorial, my goal is to show the “stock quantity or status” under each product in the shop, category and archive pages.

This follows exactly the same settings as the stock display of the single product page. Go to /wp-admin/admin.php?page=wc-settings&tab=products&section=inventory to manage “Stock display format”. Enjoy!

Continue reading WooCommerce: Display Stock Status/Quantity @ Shop Page