Skip to content

Instantly share code, notes, and snippets.

@robindevitt
Last active July 14, 2021 09:38
Show Gist options
  • Save robindevitt/2f11b0d64b9ab3cc3bf3f8620b28a781 to your computer and use it in GitHub Desktop.
Save robindevitt/2f11b0d64b9ab3cc3bf3f8620b28a781 to your computer and use it in GitHub Desktop.
add_action ('init', 'disable_store_ordering');
// Disable Cart, Checkout, Add Cart
function disable_store_ordering() {
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', 'wc_shop_disable', 5 );
add_action( 'woocommerce_before_cart', 'wc_shop_disable', 5 );
add_action( 'woocommerce_before_checkout_form', 'wc_shop_disable', 5 );
}
// Show Notice
function wc_shop_disable() {
wc_print_notice( 'Our Online Shop is Closed due to political unrest.', 'error');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment