From 192b9b4d89bb693a6f6a84baedaf892aae30ffe0 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Thu, 24 Oct 2024 20:35:34 +0530 Subject: [PATCH] chore: change promo timing - Add initial promo delay to 6 hours: https://github.com/Codeinwp/themeisle/issues/1682 - Add 21 days delay between two promos: https://github.com/Codeinwp/themeisle/issues/1675 --- src/Modules/Promotions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Modules/Promotions.php b/src/Modules/Promotions.php index 6fdff8c..f3715a5 100644 --- a/src/Modules/Promotions.php +++ b/src/Modules/Promotions.php @@ -166,7 +166,7 @@ public function load( $product ) { $last_dismiss_time = $this->get_last_dismiss_time(); - if ( ! $this->debug && is_int( $last_dismiss_time ) && ( time() - $last_dismiss_time ) < WEEK_IN_SECONDS ) { + if ( ! $this->debug && is_int( $last_dismiss_time ) && ( time() - $last_dismiss_time ) < ( 3 * WEEK_IN_SECONDS ) ) { return; } @@ -539,7 +539,7 @@ private function filter_by_screen_and_merge() { $product_install_time = (int) $this->product->get_install_time(); $is_older = time() > ( $product_install_time + ( 3 * DAY_IN_SECONDS ) ); - $is_newer = time() < ( $product_install_time + ( 5 * MINUTE_IN_SECONDS ) ); + $is_newer = time() < ( $product_install_time + ( 6 * HOUR_IN_SECONDS ) ); foreach ( $this->promotions as $slug => $promos ) { foreach ( $promos as $key => $data ) { @@ -548,9 +548,9 @@ private function filter_by_screen_and_merge() { if ( ! $this->debug && - ( + ( ( $data['delayed'] === true && ! $is_older ) || // Skip promotions that are delayed for 3 days. - $is_newer // Skip promotions for the first 5 minutes after install. + $is_newer // Skip promotions for the first 6 hours after install. ) ) { unset( $this->promotions[ $slug ][ $key ] );