There are many scenarios where online store owners might need to temporarily disable the WooCommerce checkout. For example, around the holiday season, due to a staff shortage, or simply because the products they sell are not available or on backorder.
WooCommerce Temporarily Disable Checkout
If this happens, it is a good idea to have a simple way to temporarily deactivate WooCommerce. You can also notify your customers when you will open up again. In this tutorial, I will show you to disable the checkout without deactivating the WooCommerce plugin.
You should keep in mind that if you deactivate the plugin, you would have dead links. This means that whenever a visitor tries to access your WooCommerce pages, such as your shop page or single WooCommerce product pages, they will run into a 404 page not found error message. This leads to a poor customer experience, and prospective customers might think your store is permanently closed.
Steps to Temporarily Disable Checkout
Here are the steps that you need to follow:
- Log into your WordPress site and access the dashboard as the admin user
- From the dashboard menu, click on the Appearance Menu > Theme Editor Menu. When the theme editor page is opened, look for the theme functions file with the extension functions.php. Open this functions file to Temporarily Disable Checkout
- Add the following line of code to the functions.php file:
/** * WooCommerce Holiday/Pause Mode */ // Trigger Holiday Mode add_action ('init', 'njengah_woocommerce_holiday_mode'); // Disable Cart, Checkout, Add Cart function njengah_woocommerce_holiday_mode() { remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); remove_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 ); add_action( 'woocommerce_before_main_content', 'njengah_wc_shop_disabled', 5 ); add_action( 'woocommerce_before_cart', 'njengah_wc_shop_disabled', 5 ); add_action( 'woocommerce_before_checkout_form', 'njengah_wc_shop_disabled', 5 ); } // Show Holiday Notice function njengah_wc_shop_disabled() { wc_print_notice( 'Our Online Shop is Closed Today :) Please Come Back Tomorrow!', 'error'); }
Conclusion
In this brief post, I have shared how you can temporarily disable the WooCommerce checkout. This solution will also remove the payment options and the Add to cart button. I recommend you add the code to the functions.php file of your child theme so that your changes are not lost during an update.
Similar Articles
- How to Hide Prices From Google In WooCommerce
- How to Set Up WooCommerce You Must be Logged in to Checkout
- How to Hide Admin Bar for WooCommerce Customers or By User Roles
- How to Hide Read More and Add to Cart Button WooCommerce
- How to Disable Specific Plugin Updates In WordPress
- How to Add WooCommerce Storefront Hero Image
- How to Add WooCommerce Invoice Checkout Page
- How to Edit WooCommerce Checkout Page Template
- How to Add WooCommerce VAT Number Checkout Page
- How to Set Up WooCommerce Checkout Field Placeholder
- How to Hide Shipping Rates if Free Shipping Available WooCommerce
- How to Change WooCommerce Checkout Error Messages
- How to Add Date Field to Checkout In WooCommerce
- How to Setup WooCommerce Storefront Blog
- How to Remove Related Products in WooCommerce in 3 Easy Options
- How to Remove Additional Information Checkout Page WooCommerce
- How to Hide WooCommerce Marketing Hub Admin Option
- How to Redirect a WordPress Page Without Plugins?
- How to Set Up WooCommerce Terms and Conditions Checkout