Skip to content

Instantly share code, notes, and snippets.

@chrismademe
Created April 6, 2022 12:02
Show Gist options
  • Save chrismademe/a574c8b00ac0b8d4aa455bbde73b1ca0 to your computer and use it in GitHub Desktop.
Save chrismademe/a574c8b00ac0b8d4aa455bbde73b1ca0 to your computer and use it in GitHub Desktop.
Disable WooCommerce Checkout
<?php
add_action( 'init', function() {
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', 'resknow_show_checkout_disable_notice', 5 );
add_action( 'woocommerce_before_cart', 'resknow_show_checkout_disable_notice', 5 );
add_action( 'woocommerce_before_checkout_form', 'resknow_show_checkout_disable_notice', 5 );
} );
function resknow_show_checkout_disable_notice() {
wc_print_notice( 'We\'re no longer taking online orders, please contact us to discuss your requirements.', 'error');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment