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

fix: use Woo's cart fee for covering transaction fees #2820

Merged
merged 4 commits into from
Dec 22, 2023

Conversation

miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Dec 19, 2023

All Submissions:

Changes proposed in this Pull Request:

Refactors the "cover fee" strategy to use WC()->cart->add_fee() instead of modifying the order total directly.

This PR also changes the UI to show the fee through the order review table and and no longer modify the top summary value. This consolidates how we handle additional values added to the order (coupons, fees, and taxes excluded from the total).

image image

How to test the changes in this Pull Request:

  1. Check out this branch and fix(modal-checkout): show order details table with fees newspack-blocks#1633
  2. Through the Donate block, start a one-time donation flow and confirm you can toggle the "I’d like to cover the {percentage}% transaction fee to ensure my full donation goes towards {site name}'s mission." checkbox
  3. Confirm toggling the checkbox updates the fee as shown in the image above
  4. Confirm you can place the order
  5. Visit the order details in the dashboard and confirm you can see the fee as shown in the image above
  6. Confirm the note "The donor opted to cover Stripe’s transaction fee." is also added to the order
  7. Back to the Donate block, start a recurring donation flow, and also check the fee checkbox
  8. Confirm the order review table also shows the fee added to the "Recurring totals"
  9. Place the order and confirm in the dashboard that the fee has been added
  10. Go to the subscription dashboard in WooCommerce -> Subscriptions
  11. In the "Subscription actions" metabox, select "Process renewal"
  12. Confirm the renewal order also includes the fee

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?

@miguelpeixe miguelpeixe force-pushed the fix/cover-transaction-fee-refactor branch from 368ec8e to 07bb3f3 Compare December 21, 2023 14:15
@miguelpeixe miguelpeixe self-assigned this Dec 21, 2023
@miguelpeixe miguelpeixe added the [Status] Needs Review The issue or pull request needs to be reviewed label Dec 21, 2023
@miguelpeixe miguelpeixe marked this pull request as ready for review December 21, 2023 16:26
@miguelpeixe miguelpeixe requested a review from a team as a code owner December 21, 2023 16:26
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

Works exactly as described, and I love this change because it clarifies the addition of the fee on top of the subtotal to both the customer and the admin. I also verified that the fee is included in the total populated by our custom receipt emails, so I see no reason to get this change deployed ASAP.

Screenshot 2023-12-22 at 11 55 37 AM

@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 Dec 22, 2023
@miguelpeixe miguelpeixe requested a review from dkoo December 22, 2023 19:42
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

LGTM!

@miguelpeixe miguelpeixe merged commit fded027 into master Dec 22, 2023
@miguelpeixe miguelpeixe deleted the fix/cover-transaction-fee-refactor branch December 22, 2023 20:34
matticbot pushed a commit that referenced this pull request Dec 22, 2023
# [2.13.0-alpha.2](v2.13.0-alpha.1...v2.13.0-alpha.2) (2023-12-22)

### Bug Fixes

* newsletters Lists indentation ([#2797](#2797)) ([1af3c23](1af3c23))
* **ras:** remove modal checkout logic ([#2781](#2781)) ([6aad17d](6aad17d))
* use Woo's cart fee for covering transaction fees ([#2820](#2820)) ([fded027](fded027))

### Features

* add media partners module ([#2753](#2753)) ([70f7dcb](70f7dcb))
* **donation:** additional receipt email template variables ([#2799](#2799)) ([0c9c373](0c9c373))
* force option to enble retries of failed payments ([#2808](#2808)) ([f8d35ec](f8d35ec))
* give editors permission for restricted content ([#2806](#2806)) ([64d7817](64d7817))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.13.0-alpha.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dkoo dkoo mentioned this pull request Jan 5, 2024
6 tasks
matticbot pushed a commit that referenced this pull request Jan 8, 2024
# [2.13.0](v2.12.2...v2.13.0) (2024-01-08)

### Bug Fixes

* alpha fixes ([#2835](#2835)) ([49efd8b](49efd8b))
* newsletters Lists indentation ([#2797](#2797)) ([1af3c23](1af3c23))
* **ras:** remove modal checkout logic ([#2781](#2781)) ([6aad17d](6aad17d))
* use Woo's cart fee for covering transaction fees ([#2820](#2820)) ([fded027](fded027))

### Features

* add media partners module ([#2753](#2753)) ([70f7dcb](70f7dcb))
* don’t send OTP via preauth flow when signing up for newsletter ([#2795](#2795)) ([686af03](686af03))
* **donation:** additional receipt email template variables ([#2799](#2799)) ([0c9c373](0c9c373))
* force allow subscription switching ([#2784](#2784)) ([ae7523f](ae7523f))
* force option to enble retries of failed payments ([#2808](#2808)) ([f8d35ec](f8d35ec))
* give editors permission for restricted content ([#2806](#2806)) ([64d7817](64d7817))
* **my-account:** support edit address ([#2733](#2733)) ([92d5778](92d5778))
* remove commenting from engagement tab ([#2726](#2726)) ([f51c7bc](f51c7bc))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.13.0 🎉

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 released [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