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.

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.

Test Your Checkout

I sometime test the checkout by temporarily changing the Stripe checkout to test mode and putting through a purchase.

It works, but being a manual process it depends upon my doing it – and when WordPress is updated or WooCommerce is updated, or some plugin or other that might interfere with another plugin is updated, do I test? No, I do not. Not every time. And that’s a problem.

Robot Ninja tests your checkout regularly to make sure everything is working.

As it says in its blurb;

Don’t wait days or weeks to hear from customers that your checkout isn’t working or waste the time manually checking your store. Schedule tests to run daily or weekly to save you time.
Select real products from your site to use in your tests. No more testing with dummy or $0 products or by having to create test coupons. And you are free to use actual products.

It visits the site and test products as a guest customer and also as a logged in user; it tries selecting all variation options if they exist; it adds the product to the cart; and it purchases the product using an available payment gateway (with priority on using Stripe).

Our store is connected to a fulfilment house that sends out the goods, and our system notifies the fulfilment house automatically when a customer orders a product.

When I test the checkout manually I temporarily disable the notification that is sent automatically to our fulfilment house when a customer purchases a product.

Then I re-enable notifications after I have completed the manual test.

So it’s a problem for us if the service is jumping around and testing different products, because our fulfilment house is going to be getting a lot of dummy notifications and think they are real orders.

Provided I can nominate the product that RobotNinja tests, I can set up a dummy product to be tested, and exclude it from the notifications that go to the fulfilment house.

But I have never thought to set up a dummy product to test, and exclude that from the notifications.

I would also hide the dummy product from the catalogue.

Hidden products are not visible to customers’ searches and do not appear in the shop page. So unless a ‘real’ customer knows the URL of the product, they will not find it.

Looking through the documentation I see that one can nominate a product or products to be tested.

Next thing: What happens with the payments that go through Stripe. What does Stripe think about these transactions? How does it work? I asked Support and this is the reply:

“If Stripe is used in Live mode they are treated like a normal transaction. Upon completion of an order we process a refund via the WooCommerce API and delete the order.

We also support Stripe in test mode using one of its fake card numbers they provide. You also have the option to disable “placing an order”. We complete the checkout up to the point of clicking the place order button but stop there.

We also support $0 products.

Basically there are a few different options depending on backend systems/costs/etc.

Now I need to think it through to make sure there isn’t a snag that I haven’t thought of yet. I’ll update this post when I have done that.