Hide Product Categories

If you want to pre-approve your customers (such as in a trade-only shop) then you might want to disable the visibility of pricing as the ability for visitors to buy your products.

Catalog Visibility Options

The Catalog Visibility Options plugin will do this and also let you choose which user roles can see products and product categories.

Therefore, if you want to take a category out of the shop, use the plugin to do that.

PHP code

Otherwise there is this code that I saw on Business Bloomer but the code was in the comments, and is from Jonathan from Inspired Earth

function custom_pre_get_posts_query( $q ) { $tax_query = (array) $q->get( 'tax_query' ); $tax_query[] = array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'CATEGORY-TO-HIDE' ), // Don't display products in the this category on the shop page. 'operator' => 'NOT IN' ); $q->set( 'tax_query', $tax_query ); } add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );

Here is the raw code

Where to put the code

I use the Code Snippets plugin (it’s in the WordPress repository) to contain snippets of php.

Debug

This post applies to all WordPress setups, not just WooCommerce.

The Health Check plugin has a debug function that checks common configuration errors and known issues and highlights them.

It doesn’t solve them, but it gives you the information to tackle the issue.

Theme and Plugin Conflicts

When you activate the Troubleshooting feature, it reverts your site to a default WordPress theme like Twenty Seventeen and deactivates all your plugins.

You can then turn your chosen theme back on to see whether the issue reasserts itself.

If it does then you know it’s a theme-specific issue.

If not, then you can re-activate your plugins one by one until you see the issue reappear. In that way you can resolve plugin conflict issues.

The neat part is that it does it only for you as the logged in admin. Anyone visiting the site sees your usual setup.

Take a full backup before you start…


Email Text Customizer for WooCommerce

There are two standard emails built in to WooCommerce that are sent to a customer on a successful transaction.

The first is the Processing Order email. It is and sent automatically as soon as a payment goes through.

The second is the Completed Order email, and is sent manually by the site owner when he/she marks the transaction as complete in the back end, (which generally means when the goods are dispatched).

If you are happy with the standard text in those emails, then all is well.

If you want to change the text to suit your style or how your shop operates, then unfortunately, there is nothing in the WooCommerce admin page where you can change the body text of those emails.

If you google for how to do it, you will see reference to changing core templates and translation strings, all of which are more complicated than using the Email Text Customizer plugin.

With the plugin activated, there will be a new field where you can change the body text of the emails.