AI Verified

Name

Disable Shop

About

Disable the shop and display a temporary closed message

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

PRM-Vault

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

06/01/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Disable Shop

 
                    
1// Trigger Holiday Mode
2add_action ('init', 'bbloomer_woocommerce_holiday_mode');
3 
4 
5// Disable Cart, Checkout, Add Cart
6function bbloomer_woocommerce_holiday_mode() {
7remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
8remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
9remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
10remove_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
11add_action( 'woocommerce_before_main_content', 'bbloomer_wc_shop_disabled', 5 );
12add_action( 'woocommerce_before_cart', 'bbloomer_wc_shop_disabled', 5 );
13add_action( 'woocommerce_before_checkout_form', 'bbloomer_wc_shop_disabled', 5 );
14}
15function bbloomer_wc_shop_disabled() {
16wc_print_notice( 'Our Online Shop is Closed Until Further Notice. Thank You!', 'error');
17 
18}
19 
20?>

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

1

WooCommerce Change Choose An Option Text From Variable Add To Cart

Added: 1 year ago

Last Updated: 2 months ago

Changing the variable product drop down text from “Choose An Option” is key to tailoring your store for a better User Experience (UX). If you’re using dates as variations for example, it doesn’t reall...

WooCommerce

AI Verified

0

WooCommerce Thank You Page Up-Sells

Added: 1 year ago

Last Updated: 1 year ago

Depending on your website theme, WooCommerce by default will only show product up-sells on the product page. Up-sells are products that you recommend instead of the currently viewed product. They are...

WooCommerce

AI Verified

0

Upgrade User to VIP Role After First Purchase

Added: 6 months ago

Last Updated: 6 months ago

This code automatically promotes users to the VIP role after their first purchase on the WooCommerce platform. It checks if the user hasn't already been assigned the VIP role, and if not, it changes t...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

0

Disable Shop

Added: 1 year ago

Last Updated: 1 year ago

Disable the shop and display a temporary closed message