How Do I Turn Off Purchases in WooCommerce?
If you’re running a WooCommerce store, there may be times when you need to disable purchases altogether. Maybe you’re performing some maintenance on your site, or you’re running a temporary promotion that doesn’t require customers to actually purchase anything. Whatever the reason, turning off purchases in WooCommerce is actually pretty easy to do.
There are two ways to go about it: using the built-in WooCommerce settings, or with a little bit of code. Let’s take a look at both methods.
Method 1: Using the WooCommerce Settings
WooCommerce comes with a built-in setting that allows you to disable purchases on your site with just a few clicks. Here’s how to do it:
1. Log into your WordPress dashboard and go to WooCommerce > Settings. 2. On the Settings page, go to the General tab and scroll down to the Store Notice section. 3. In the Store Notice section, check the Enable this notice on my store checkbox.
This will enable the text field below, where you can enter your notice. 4. In the text field, enter a message telling your customers that purchases are currently disabled on your site. Something like “We’re sorry, but purchases are currently disabled.” will do. 5. Save your changes and exit the Settings page.
That’s all there is to it! With this method, any time a customer tries to add an item to their cart, they’ll see your notice informing them that purchases are disabled.
Method 2: Disabling Purchases with Code
If you’re not comfortable using the WooCommerce settings, or if you want more control over when purchases are disabled on your site, you can do so with code. This method requires adding a few lines of code to your site, but don’t worry – it’s still pretty easy to do.
First, you’ll need to open up your site’s .htaccess file (this file controls access to your site’s files and folders). You can edit this file directly from your WordPress dashboard by going to Settings > Permalinks.
Scroll down to the Optional section and click on the .htaccess File link. This will open up the file in a text editor where you can make changes.
Once you have the .htaccess file open, add the following lines of code:
# BEGIN Disable Purchases
Order allow,deny
Deny from all
# END Disable Purchases
Save your changes and close the file. This code tells WordPress to block all access to files related to WooCommerce purchases (such as the checkout, cart, and my-account) pages).
Any time someone tries to access one of these pages, they’ll see an error message saying that they don’t have permission to view the page. Now that we’ve added this code, purchases will be disabled on our site until we remove it (or comment it out). To re-enable purchases, simply remove (or comment out) these lines of code from your .htaccess
> file and save your changes.
There are two ways to turn off purchases in WooCommerce – using the built-in settings or with code.
Using the settings is easy – just go to WooCommerce > Settings and enter a message in the Store Notice section.
If you want more control over when purchases are disabled or want to disable them only temporarily, you can add some code to your site’s .htaccess file.
Just remember – if you add code to disable purchases, be sure to remove it (or comment it out) when you want customers to be able purchase items from your store again!