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

feat: fixes and improvements for WooCommerce Subscriptions Gifting #3747

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Feb 13, 2025

All Submissions:

Changes proposed in this Pull Request:

  • Establishes a new class for the WooCommerce Subscriptions Gifting (WCSG) extension and moves some existing functionality to this class.
  • Fixes an issue where shipping address fields aren't required even if a recipient is gifted a shippable product.
  • FIxes an issue where the "Addresses" menu item isn't shown in My Account if the user has a shipping address but no billing address.
  • Along with feat(wcsg): respect checkbox label option in WCSG settings newspack-blocks#2053, allows non-donation modal checkouts to show the "Gifting Checkbox Text" setting instead of a hardcoded label.

How to test the changes in this Pull Request:

  1. Check out this branch and feat(wcsg): respect checkbox label option in WCSG settings newspack-blocks#2053 and activate the WooCommerce Subscriptions Gifting plugin. Delete the "Gifting Checkbox Text" option, in case it's been set before (with CLI: wp option delete woocommerce_subscriptions_gifting_gifting_checkbox_text)
  2. Publish a subscription product that's NOT virtual or downloadable, and set up a shipping zone/method in WooCommerce settings (documentation)
  3. Add a Checkout Button block set to this shippable subscription product.
  4. As a reader, start a modal checkout with this shippable subscription product and confirm that a gifting checkbox appears on the first modal screen with the default non-donation label "This purchase is a gift":
Screenshot 2025-02-12 at 4 28 15 PM
  1. As an admin, go to WooCommerce > Settings > Subscriptions and update the setting for Gifting Checkbox Text to something custom, then save:
Screenshot 2025-02-12 at 4 29 34 PM
  1. As a reader, start a modal checkout with the shippable subscription product and confirm that the label has changed to the custom setting from step 5:
Screenshot 2025-02-12 at 4 27 10 PM
  1. As the reader, check the gifting option, enter a gift recipient's email address, and complete the transaction.
  2. In a new session, log into the site as a reader using the gift recipient's email address.
  3. Confirm that immediately upon logging in, you're required to enter any billing address fields as required in Newspack > Reader Revenue > Donations billing fields settings, plus all shipping address fields.
Screenshot 2025-02-12 at 5 01 06 PM
  1. After submitting the required info, confirm that the "Addresses" menu item appears in the My Account menu:
Screenshot 2025-02-12 at 5 02 03 PM
  1. Visit My Subscription and confirm that the shipping address is applied to the gifted subscription:
Screenshot 2025-02-12 at 5 02 52 PM

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 13, 2025
@dkoo dkoo self-assigned this Feb 13, 2025
@dkoo dkoo marked this pull request as ready for review February 13, 2025 00:03
@dkoo dkoo requested a review from a team as a code owner February 13, 2025 00:03
Copy link
Member

@naxoc naxoc left a comment

Choose a reason for hiding this comment

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

I took a look at this an it looks good. When testing everything worked – except this one:

Confirm that immediately upon logging in, you're required to enter any billing address fields as required in Newspack > Reader Revenue > Donations billing fields settings, plus all shipping address fields.

I just got a modal saying I was logged in. I did get the address page first thing when I navigated to my-account though.

@dkoo
Copy link
Contributor Author

dkoo commented Feb 18, 2025

I just got a modal saying I was logged in. I did get the address page first thing when I navigated to my-account though.

Oops, I was a little too vague in the testing instructions. This is correct; you're presented with the page to enter missing address fields when you first visit My Account after logging in. In some login flows (such as if you click the link to claim your gift directly from the email) you will automatically be redirected to My Account after login, but in other login flows you won't be redirected.

@dkoo dkoo requested a review from naxoc February 18, 2025 17:56
Copy link
Member

@naxoc naxoc left a comment

Choose a reason for hiding this comment

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

OK, this looks good to go then!

ok

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Feb 18, 2025
@dkoo dkoo merged commit 49c4b35 into trunk Feb 18, 2025
9 checks passed
@dkoo dkoo deleted the feat/wcsg-improvements branch February 18, 2025 18:09
Copy link

Hey @dkoo, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

matticbot pushed a commit that referenced this pull request Feb 20, 2025
# [6.0.0-alpha.1](v5.14.2...v6.0.0-alpha.1) (2025-02-20)

### Bug Fixes

* **campaigns:** remove placeholder Analytics admin page ([#3729](#3729)) ([abd1bc2](abd1bc2))
* **corrections:** address feedbacks on improving code ([b84fab2](b84fab2))
* **corrections:** improve code formatting ([11ed58c](11ed58c))
* **donations:** handle trashed products and avoid creating dupes ([#3760](#3760)) ([5e78832](5e78832))
* **esp-sync:** transform outgoing dates to site timzeone ([#3728](#3728)) ([77dc361](77dc361))
* **perfmatters:** default for lazyload img setting parent selector ([#3753](#3753)) ([491e335](491e335))
* **recaptcha:** improvements for reCAPTCHA v2 + modal checkout ([#3692](#3692)) ([c4738a7](c4738a7))
* **recaptcha:** no need to scroll to top when showing v2 widget ([#3741](#3741)) ([882d55c](882d55c))
* **woocommerce:** add team name to checkouts for memberships-for-teams ([#3752](#3752)) ([e3661c6](e3661c6))

### Features

* **corrections-modal:** refactor corrections admin UI ([0adac63](0adac63))
* **corrections:** add date handling to corrections and enhance UI ([4c77020](4c77020))
* **corrections:** add site timezone handling logic for correction date ([28d3bb9](28d3bb9))
* **corrections:** update style of modal in the editor ([#3766](#3766)) ([0aee542](0aee542))
* **esp-sync:** queue data events sync to run once ([#3661](#3661)) ([dd2b499](dd2b499))
* fixes and improvements for WooCommerce Subscriptions Gifting ([#3747](#3747)) ([49c4b35](49c4b35))
* handle user nicename change ([#3725](#3725)) ([cb045a3](cb045a3))
* **my-account:** add email change feature flag ([#3758](#3758)) ([21f2c30](21f2c30))
* rate limit adding new payment methods by user ([#3679](#3679)) ([0fd5ea5](0fd5ea5))

### BREAKING CHANGES

* **recaptcha:** shippable product orders will auto-complete by default after this change.

* chore: undo unwanted change
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants