Created
April 6, 2022 12:02
-
-
Save chrismademe/a574c8b00ac0b8d4aa455bbde73b1ca0 to your computer and use it in GitHub Desktop.
Disable WooCommerce Checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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