How To Temporarily Disable Checkout In WooCommerce

advert

Introduction: What is WooCommerce and How Does it Work?

WooCommerce is a free and open-source e-commerce plugin for WordPress. It is designed to be used as an e-commerce platform for small businesses, online retailers, and entrepreneurs.

WooCommerce offers a number of features that make it the perfect solution for any business looking to start an online store. These features include:

A powerful shopping cart system that allows customers to purchase products from your store with just a few clicks of their mouse

The ability to create custom product pages with all the information your customer needs in order to make a purchase decision The ability to offer flexible shipping options and provide detailed tracking information on orders

A built-in payment gateway so customers can pay for their purchases securely without leaving your site

Temporarily Disable Checkout In WooCommerce

WooCommerce disable checkout temporally while in vacation. If you’re a WooCommerce store owner and you’re looking for a way to temporarily disable checkout, then this is the video for you. In this video tutorial, I’ll show you how to hide the “Checkout” button in WooCommerce with just a few clicks.

WooCommerce temporally disable checkout will help you to never miss out customer delivery thus increasing customers trust.

For you to add the feature you will need to install a free plugin Code snippet.

code snippet thumbnail

Steps to install the plugin:

  • On the dashboard menu, hover on plugin,
  • Select add new,
  • on plugin repository search for code snippet,
  • install and activate the plugin,
  • follow the YouTube tutorial for much guidance.

To temporally disable WooCommerce checkout follow attached tutorial

To add the feature I have divided it into 3 section

  • // Trigger Holiday Mode
 add_action ('init', 'woo_woocommerce_holiday_mode');
  • // Disable Cart, Checkout, Add Cart
function woo_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', 'woo_wc_shop_disabled', 5 );

   add_action( 'woocommerce_before_cart', 'woo_wc_shop_disabled', 5 );

   add_action( 'woocommerce_before_checkout_form', 'woo_wc_shop_disabled', 5 );

}
  • // Show Holiday Notice
function woo_wc_shop_disabled() {

        wc_print_notice( 'Our Online Shop is Closed Today :) Please Come Back Tomorrow!', 'error');

}

Note : You can customize the notice to a custom note.

In conclusion: Here is the full code to use in to add the feature to your WooCommerce website:

/**
 *    WooCommerce Holiday/Pause Mode
*/

 // Trigger Holiday Mode

 add_action ('init', 'woo_woocommerce_holiday_mode');

  // Disable Cart, Checkout, Add Cart

 function woo_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', 'woo_wc_shop_disabled', 5 );

   add_action( 'woocommerce_before_cart', 'woo_wc_shop_disabled', 5 );

   add_action( 'woocommerce_before_checkout_form', 'woo_wc_shop_disabled', 5 );

}

 // Show Holiday Notice

 function woo_wc_shop_disabled() {

        wc_print_notice( 'Our Online Shop is Closed Today :) Please Come Back Tomorrow!', 'error');

}

Hope you were able to add the feature to you website. You may also like to read these post: WooCommerce logout without confirmation: how to remove “Are you sure you want to Logout?”

WooCommerce-logout-without-confirmation

advert:

Support us:

1
0
Would love your thoughts, please comment.x
()
x

Login To Access Code Snippet:

Stay UpTo Date with Latest Post And news: