From 9e6583b7f2f07ce8ed97d295e6e0c005cd83da89 Mon Sep 17 00:00:00 2001 From: Rasmy Nguyen Date: Tue, 27 Aug 2024 16:49:05 -0400 Subject: [PATCH 1/2] fix(ras-acc): update limited subscription error message --- includes/class-modal-checkout.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/class-modal-checkout.php b/includes/class-modal-checkout.php index bf51265e0..ea1519a93 100644 --- a/includes/class-modal-checkout.php +++ b/includes/class-modal-checkout.php @@ -1064,7 +1064,11 @@ public static function pass_url_param_on_redirect( $location ) { * @return string */ public static function get_subscription_limited_message() { - return __( 'You may only have one subscription of this product at a time.', 'newspack-blocks' ); + return sprintf( + // translators: %s: Site name. + __( "You're already a subscriber! You can only have one active subscription at a time. Thank you for supporting %s.", 'newspack-blocks' ), + get_bloginfo( 'name' ) + ); } /** @@ -1079,7 +1083,7 @@ public static function woocommerce_cart_product_cannot_be_purchased_message( $me if ( method_exists( 'WCS_Limiter', 'is_purchasable' ) ) { $product = \wc_get_product( $product_data->get_id() ); if ( ! \WCS_Limiter::is_purchasable( false, $product ) ) { - $message .= ' ' . self::get_subscription_limited_message(); + $message = self::get_subscription_limited_message(); } } From c5232e1587728dff8f78baf3dc6ce74ae3e8e755 Mon Sep 17 00:00:00 2001 From: Rasmy Nguyen Date: Tue, 27 Aug 2024 17:05:39 -0400 Subject: [PATCH 2/2] fix(ras-acc): update limited subscription error style and layout --- includes/class-modal-checkout.php | 1 + src/modal-checkout/checkout.scss | 6 ++++++ src/modal-checkout/index.js | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/includes/class-modal-checkout.php b/includes/class-modal-checkout.php index ea1519a93..1fe35d05a 100644 --- a/includes/class-modal-checkout.php +++ b/includes/class-modal-checkout.php @@ -670,6 +670,7 @@ public static function get_checkout_template( $template ) { // Trigger checkout error event if there are cart errors. if ( is_cart() && ! empty( $wc_errors ) ) : ?> + diff --git a/src/modal-checkout/checkout.scss b/src/modal-checkout/checkout.scss index b250c183f..a2e50b14d 100644 --- a/src/modal-checkout/checkout.scss +++ b/src/modal-checkout/checkout.scss @@ -529,6 +529,11 @@ margin-top: 0; } + // stylelint-disable-next-line selector-id-pattern + #checkout_error_back { + margin-bottom: 0; + } + form.checkout .woocommerce-NoticeGroup, .woocommerce .woocommerce-notices-wrapper { li div { @@ -550,6 +555,7 @@ .woocommerce .woocommerce-notices-wrapper { margin-bottom: var(--newspack-ui-spacer-5, 24px); + margin-top: 0; } .processing { diff --git a/src/modal-checkout/index.js b/src/modal-checkout/index.js index 85e772028..647431ff6 100644 --- a/src/modal-checkout/index.js +++ b/src/modal-checkout/index.js @@ -677,6 +677,13 @@ domReady( ( _, error ) => $( error ).addClass(`${ CLASS_PREFIX }__notice ${ CLASS_PREFIX }__notice--error` ) ); } + const $checkout_error_back = $( '#checkout_error_back' ); + if ( $checkout_error_back.length ) { + $checkout_error_back.on( 'click', ev => { + ev.preventDefault(); + parent.newspackCloseModalCheckout() + } ); + } setReady(); } );