Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Turn off the WooCommerce Store Notice at a specific date and time.
<?php
/**
* Turn off the WooCommerce Store Notice at a specific date and time.
*/
function modify_woocommerce_demo_store_turn_off_date( $notice_html ) {
// Set the current date variable.
$current_date = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
// Change this line to set the store notice end date and time variable.
$end_date = '2022-06-08 10:00:00';
// If the current date is before the end date, show banner.
if ( $current_date < $end_date ) {
return $notice_html;
}
// Return an empty string if not within the set time.
return '';
}
add_filter( 'woocommerce_demo_store', 'modify_woocommerce_demo_store_turn_off_date', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment