WooCommerce Hide Categories On Shop Page

Posted on by MWD

A client of our requested a feature to hide certain WooCommerce categories from their shops main page. While this is a fairly easy task using your functions.php file and woocomerce plugin functions, we wanted a user friendly, easily updatable solution.


The solution:

=== Hide Categories On Shop Page ===
Contributors: WMEric
Tags: WordPress, WooCommerce, e-Commerce
Requires at least: 3.0.1
Tested up to: 4.9.5
Stable tag: 4.9.5
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Simple solution to hide specific categories in you woocommerce shop main page i.e. domain.com/shop This plugin was based on WC Hide Categories On Shop Page located at https://wordpress.org/plugins/wc-hide-categories-on-shop-page/ However it did not work and wasn’t maintained.

== Description ==

This free WooCommerce extension permits you to hide categories on your shops main page.
For this you have to save the categories with ‘,’ seperated in woocommerce > settings > products tab section.

In order for this to work you have to have Categories displayed. This can be set via Customizer. Appearance > Customize > WooCommerce > Product Catalog.

“Choose what to display on the main shop page.” Select Show categories as seen in the Screenshot below.

== Installation ==

* Upload ‘wc-hide-categories.zip’ like any other plugin or upload the zip file contents to the ‘/wp-content/plugins/’ directory
* Activate the plugin through the ‘Plugins’ menu in WordPress
* Configure the plugin at Dashboard > WooCommerce > Settings > Products > Hide Categories On Shop Page
* Save your settings with the category slugs with ‘,’ seperated.
* I.E. cat1, cat2, cat3

== Frequently Asked Questions ==

None at this time

== Changelog ==

= 1.0.1 =
* Added the conditionals to test if the shop is_home() or is_front_page() and added the a fourth test a user could uncomment to add their custom shop page slug.

= 1.0 =
* Stable initial release

== Upgrade Notice ==

= 1.0.1 =
Users should use this version and disregard version 1.0

== Arbitrary section ==

For users who has a different/custom page for their shop you can edit the wc-hide-categories.php file
Find line # 127 and remove //

`//$mwd_opt4 = in_array( ‘product_cat’, $taxonomies ) && ! is_admin() && is_page(‘YOUR_PAGE_SLUG’),`

Then find line #129 `/*|| $mwd_opt4*/`

Change to
`|| $mwd_opt4`

If you have any question please ask in the support forum, Thanks

Download it here for freeĀ hide-woocommerce-categories-on-shop-page

Or on the official wordpress.org site atĀ https://wordpress.org/plugins/hide-categories-on-shop-page/

Posted in Plugins | Leave a comment