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

[ECE] Hide express payment buttons on switch subscription page #3610

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Nov 18, 2024

Fixes #3608

Changes proposed in this Pull Request:

As switch subscription page is basically the product page, when paid with ECE/PRB the full amount is charged instead of the difference. We are hiding the PRB/ECE buttons from the switch subscription page.

Testing instructions

  • Enable the new checkout experience.
  • Enable the ECE feature flag.
  • Enable Google/Apple Pay from Stripe settings page.
  • Install the WooCommerce Subscription plugin.
  • Go to 'WooCommerce > Settings > Subscriptions' page. Enable subscription switching and prorating.
  • Create a variable subscription product with 2 variations (Blue: 50 USD and Red: 60 USD).
  • As a shopper, purchase the Blue variation.
  • From 'My Account > Subscriptions' page find your subscription.
  • Click on upgrade your subscription button.
  • You will be taken to the product page to switch the product variation.
  • In develop branch, you can see the ECE button on this page.
Screenshot 2024-11-18 at 1 21 49 PM
  • On this branch, you should not see the ECE button on the switch subscription page.
  • Confirm that the ECE buttons are rendered correctly on cart and checkout pages when you click the switch button and it is added to the cart.

@Mayisha Mayisha requested review from a team and wjrosa and removed request for a team November 18, 2024 07:39
@@ -85,6 +85,11 @@ public function init() {
return;
}

// Don't load for switch subscription page.
if ( isset( $_GET['switch-subscription'] ) ) {
return true;
Copy link
Contributor

@wjrosa wjrosa Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason for the true value here? I'm just asking because the other return statements above do not have a value (void).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I added this check inside another function (which should return a boolean) at first and copied it over from there. It is a copy paste error on my end 🤦‍♀️

Fixed in 2a0929f

@Mayisha Mayisha requested a review from wjrosa November 18, 2024 14:56
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, Mayisha! Works as expected:

On this branch, you should not see the ECE button on the switch subscription page.

Screenshot 2024-11-19 at 14 18 56

Confirm that the ECE buttons are rendered correctly on cart and checkout pages when you click the switch button and it is added to the cart.

Screenshot 2024-11-19 at 14 16 05
Screenshot 2024-11-19 at 14 16 17

@Mayisha Mayisha merged commit 5040f12 into develop Nov 20, 2024
34 of 35 checks passed
@Mayisha Mayisha deleted the fix/3608-ece-on-switch-sub branch November 20, 2024 07:19
@Mayisha Mayisha changed the title Hide express payment buttons on switch subscription page [ECE] Hide express payment buttons on switch subscription page Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ECE] Fix ECE button behavior on switch subscription page
2 participants