Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/377c7652028cdd1eae2baaaf230d6001 to your computer and use it in GitHub Desktop.
Save kimcoleman/377c7652028cdd1eae2baaaf230d6001 to your computer and use it in GitHub Desktop.
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