Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #6349: Update renewal banner with discount percentage instead of difference #6397

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions inc/Engine/License/Renewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function display_renewal_soon_banner() {

$data = $this->get_banner_data();
$data['countdown'] = $this->get_countdown_data();
$discount = esc_html( '$' . number_format_i18n( $this->get_discount_percent(), 2 ) );
$discount = esc_html( $this->get_discount_percent() . '%' );
$price = esc_html( '$' . number_format_i18n( $this->get_price(), 2 ) );

$data['message'] = sprintf(
Expand Down Expand Up @@ -152,7 +152,7 @@ public function display_renewal_expired_banner() {
esc_html__( 'Renew your license for 1 year now and get %1$s%3$s OFF%2$s immediately: you will only pay %1$s%4$s%2$s!', 'rocket' ),
'<strong>',
'</strong>',
esc_html( '$' . number_format_i18n( $this->get_discount_percent(), 2 ) ),
esc_html( $this->get_discount_percent() . '%' ),
$price
);
}
Expand Down Expand Up @@ -325,11 +325,7 @@ private function get_discount_percent() {
$prices = $prices->prices;

if ( $renewals['is_grandfather'] ) {
return isset( $prices->renewal->is_grandfather, $prices->renewal->not_grandfather ) ? $prices->renewal->not_grandfather - $prices->renewal->is_grandfather : 0;
}

if ( $renewals['is_grandmother'] ) {
return isset( $prices->renewal->is_grandmother, $prices->renewal->not_grandfather ) ? $prices->renewal->not_grandfather - $prices->renewal->is_grandmother : 0;
return $renewals['discount_percent']->is_grandfather;
}

return 0;
Expand Down
6 changes: 3 additions & 3 deletions inc/Engine/License/views/renewal-expired-banner-ocd.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
defined( 'ABSPATH' ) || exit;
?>
<section class="rocket-renewal-expired-banner" id="rocket-renewal-banner">
<h3 class="rocket-expired-title"><?php esc_html_e( 'You will soon lose access to some features', 'rocket' ); ?></h3>
<h3 class="rocket-expired-title"><?php esc_html_e( 'You will soon lose access to some features.', 'rocket' ); ?></h3>
<div class="rocket-renewal-expired-banner-container">
<div class="rocket-expired-message">
<p>
<?php
<?php
printf(
// translators: %1$s = <strong>, %2$s = </strong>.
esc_html__( 'You need an %1$sactive license to continue optimizing your CSS delivery%2$s.', 'rocket' ),
Expand All @@ -26,7 +26,7 @@
<?php
printf(
// translators: %1$s = <strong>, %2$s = </strong>, %3$s = date.
esc_html__( 'They will be %1$sautomatically disabled on %3$s%2$s.', 'rocket' ),
esc_html__( 'These features will be %1$sautomatically disabled on %3$s%2$s.', 'rocket' ),
'<strong>',
'</strong>',
esc_html( $data['disabled_date'] )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'renewals' => json_decode( json_encode( [
'extra_days'=> 15,
'grandfather_date'=> 1640995200,
'grandmother_date'=> 1672531200,
'grandmother_date'=> 315532800,
'discount_percent'=> [
'is_grandfather' => 20,
'not_grandfather'=> 0,
Expand Down Expand Up @@ -95,7 +95,7 @@
'template' => 'renewal-expired-banner-ocd',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$19.8 OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'message' => 'Renew your license for 1 year now and get <strong>20% OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'disabled_date' => strtotime( 'now + 5 days' ),
],
],
Expand All @@ -119,7 +119,7 @@
'template' => 'renewal-expired-banner-ocd',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$10 OFF</strong> immediately: you will only pay <strong>$49</strong>!',
'message' => 'Renew your license for 1 year now at <strong>$59</strong>.',
'disabled_date' => strtotime( 'now + 5 days' ),
],
],
Expand Down Expand Up @@ -184,7 +184,7 @@
'template' => 'renewal-expired-banner-ocd',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$19.8 OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'message' => 'Renew your license for 1 year now and get <strong>20% OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'disabled_date' => strtotime( 'now + 5 days' ),
],
],
Expand Down Expand Up @@ -278,7 +278,7 @@
'template' => 'renewal-expired-banner',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$19.8 OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'message' => 'Renew your license for 1 year now and get <strong>20% OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
],
],
],
Expand All @@ -301,7 +301,7 @@
'template' => 'renewal-expired-banner',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$10 OFF</strong> immediately: you will only pay <strong>$49</strong>!',
'message' => 'Renew your license for 1 year now at <strong>$59</strong>.',
],
],
],
Expand Down Expand Up @@ -387,7 +387,7 @@
'template' => 'renewal-expired-banner',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$19.8 OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
'message' => 'Renew your license for 1 year now and get <strong>20% OFF</strong> immediately: you will only pay <strong>$39.2</strong>!',
],
],
],
Expand All @@ -410,7 +410,7 @@
'template' => 'renewal-expired-banner',
'data' => [
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
'message' => 'Renew your license for 1 year now and get <strong>$10 OFF</strong> immediately: you will only pay <strong>$49</strong>!',
'message' => 'Renew your license for 1 year now at <strong>$59</strong>.',
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'renewals' => json_decode( json_encode( [
'extra_days'=> 90,
'grandfather_date'=> 1567296000,
'grandmother_date'=> 1672389000,
'grandmother_date'=> 315532800,
'discount_percent'=> [
'is_grandfather' => 20,
'not_grandfather'=> 0,
Expand Down Expand Up @@ -118,7 +118,7 @@
],
'expected' => [
'countdown' => $countdown,
'message' => 'Renew with a <strong>$9.8 discount</strong> before it is too late, you will only pay <strong>$24.5</strong>!',
'message' => 'Renew before it is too late, you will only pay <strong>$34.3</strong>!',
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
],
],
Expand All @@ -135,7 +135,7 @@
'pricing' => $pricing,
],
'expected' => [
'message' => 'Renew with a <strong>$9.8 discount</strong> before it is too late, you will only pay <strong>$24.5</strong>!',
'message' => 'Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$24.5</strong>!',

'countdown' => $countdown,
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
Expand Down Expand Up @@ -173,7 +173,7 @@
],
'expected' => [
'countdown' => $countdown,
'message' => 'Renew with a <strong>$19.8 discount</strong> before it is too late, you will only pay <strong>$49.5</strong>!',
'message' => 'Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$49.5</strong>!',
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
],
],
Expand All @@ -191,7 +191,7 @@
],
'expected' => [
'countdown' => $countdown,
'message' => 'Renew with a <strong>$49.8 discount</strong> before it is too late, you will only pay <strong>$124.5</strong>!',
'message' => 'Renew before it is too late, you will only pay <strong>$174.3</strong>!',
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
],
],
Expand Down Expand Up @@ -227,7 +227,7 @@
],
'expected' => [
'countdown' => $countdown,
'message' => 'Renew with a <strong>$49.8 discount</strong> before it is too late, you will only pay <strong>$124.5</strong>!',
'message' => 'Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$124.5</strong>!',
'renewal_url' => 'https://wp-rocket.me/checkout/renew/roger@wp-rocket.me/da5891162a3bc2d8a9670267fd07c9eb/',
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'renewals' => [
'extra_days'=> 90,
'grandfather_date'=> 1567296000,
'grandmother_date'=> 1672389000,
'grandmother_date'=> 315532800,
'discount_percent'=> [
'is_grandfather' => 20,
'not_grandfather'=> 0,
Expand Down Expand Up @@ -133,7 +133,7 @@
Your <strong>WP Rocket license is about to expire</strong>: you will soon lose access to product updates and support.
</p>
<p>
Renew with a <strong>$9.80 discount</strong> before it is too late, you will only pay <strong>$24.50</strong>!
Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$24.50</strong>!
</p>
</div>
<div class="rocket-renew-cta-container">
Expand Down Expand Up @@ -193,7 +193,7 @@
Your <strong>WP Rocket license is about to expire</strong>: you will soon lose access to product updates and support.
</p>
<p>
Renew with a <strong>$19.80 discount</strong> before it is too late, you will only pay <strong>$49.50</strong>!
Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$49.50</strong>!
</p>
</div>
<div class="rocket-renew-cta-container">
Expand Down Expand Up @@ -254,7 +254,7 @@
Your <strong>WP Rocket license is about to expire</strong>: you will soon lose access to product updates and support.
</p>
<p>
Renew with a <strong>$49.80 discount</strong> before it is too late, you will only pay <strong>$124.50</strong>!
Renew with a <strong>20% discount</strong> before it is too late, you will only pay <strong>$124.50</strong>!
</p>
</div>
<div class="rocket-renew-cta-container">
Expand Down
Loading