woocommerce how to hide cart

WooCommerce – How to Hide Header on Cart Page

Published by Jose Vega on August 6, 2018

Hi. In this tutorial we´ll show you how to hide the header on the WooCommerce Cart page.

Why should you hide the header on cart pages?

When users visit your store and add products to cart, they go to the cart page to check the total and decide whether to complete the purchase or not.

So your goal should be to remove all distractions.

Every link can distract users and make them leave, and probably never complete the purchase.

How to hide the header

Removing/hiding the header on a page usually requires coding , but we created a WordPress plugin that lets you do it without code.

The entire process is very easy. You can do it in less than 5 minutes, no code required.

Please follow these steps:

1. Install the plugin

Then you need to install the plugin and activate it on your WordPress site.

2. Open the Cart page on the Editor

In your WordPress Admin , go to the pages section and edit the “Cart” page.

You will see the normal editor.

3. Locate the “Page Templates” section

There you will find our plugin options.

Select the options “Use custom settings for this page” and “Hide header”.

4. Save changes

Now you just need to save changes. You can open the cart page and you´ll see the header is removed automatically.

This works with all themes and under any site configuration.

How to Hide/remove/disable Add to cart button in WooCommerce ?

Free Plugin to Remove Add To Cart Button: Download at WordPress.org

Today we are going to do a bit of customization in the WooCommerce. Before, moving to the solution I assume that you have installed WordPress and WooCommerce on that successfully.

Now let’s move to the solution. When the problem came to me the first thought in my mind was to edit template files. That could be one approach but not a wise one for such a small customization.

After doing some research, I’ve came to the conclusion that luckily WooCommerce allows multiple hooks, with the help of these hooks, we can remove prices and buttons.

After installing WordPress go to backend and add a product. You can name it as you want and fill the details. See the image below:

Now on the front end you can see add to cart button on product listing i.e. shop page and product detail page as shown in the figures below.

Now we need to remove this button.

So, to remove add to cart button from product detail page and shop page i.e. product listing page all we need to do is to add these two hooks.

We can place this code in any place where it should be appropriate.

In some cases, we can add them to functions.php file but in some cases it may generate some error. So, I’m going to place these hooks in woocommerce.php file under the plugins folder.

To access this file go to wordpress > wp-content > plugins > woocommerce and open the file woocommerce.php there and after line 904 place these two hooks.

Save the file then refresh page. Add to cart buttons should have been removed from the site.

How to remove the Add to Cart button from a specific product Only?

There are a couple of ways to do that, depending on the desired result:

1- You could simply empty the price fields. The product will no longer have a price, nor an Add to cart button.
2- You could enable stock management, and set the product stock to zero.
3- You could write a filter for the “woocommerce_is_purchasable” hook, and return false when the product ID is the target one. This would leave the price visible, and display a “product cannot be purchased” note instead of the Add to cart button.

Leave a Reply

Your email address will not be published. Required fields are marked *