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(woocommerce-emails): use the default email if there are no donation products #3545

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

adekbadek
Copy link
Member

@adekbadek adekbadek commented Nov 13, 2024

All Submissions:

Changes proposed in this Pull Request:

Fixes the custom receipt emails, so that they are not sent for order which do not contain donation products.

How to test the changes in this Pull Request:

  1. Ensure you have donation products set up, and at least one non-donation product
  2. Ensure the custom receipt email is enabled in Reader Revenue wizard -> Emails
  3. Donate and observe the custom email is sent
  4. Buy a non-donation product and observe a default WC email is sent

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?

@adekbadek adekbadek added the [Status] Needs Review The issue or pull request needs to be reviewed label Nov 13, 2024
@adekbadek adekbadek requested a review from a team as a code owner November 13, 2024 09:58
@@ -266,6 +266,19 @@ public static function force_disable_order_attribution( $should_allow ) {
* @return bool
*/
public static function send_customizable_receipt_email( $enable, $order, $class ) {
// If there are no donation products in the order, do not override the default WC receipt email.
$has_donation_product = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

In other places we check this using

$product_id = \Newspack\Donations::get_order_donation_product_id( $order_id );

which is basically the same thing you do here. Isn't it simples if we just use that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, thanks! Changed in b3e62f0

@adekbadek adekbadek requested a review from leogermani November 15, 2024 08:38
@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 Nov 18, 2024
@adekbadek adekbadek merged commit 60c21f3 into trunk Nov 21, 2024
8 checks passed
@adekbadek adekbadek deleted the fix/wc-default-emails branch November 21, 2024 08:40
Copy link

Hey @adekbadek, 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! ❤️

@leogermani leogermani mentioned this pull request Nov 29, 2024
6 tasks
matticbot pushed a commit that referenced this pull request Nov 29, 2024
# [5.9.0-alpha.1](v5.8.1...v5.9.0-alpha.1) (2024-11-29)

### Bug Fixes

* **ras-acc:** make helper text size more specific ([#3584](#3584)) ([5bcc688](5bcc688))
* undefined var ([#3585](#3585)) ([00d8bc7](00d8bc7))
* **woocommerce-emails:** use the default email payload if there are no donation products ([#3545](#3545)) ([60c21f3](60c21f3))

### Features

* mark perfmatters as a required plugin ([#3578](#3578)) ([f20291c](f20291c))
* **ras-acc:** add reader account creation and login improvements ([#3582](#3582)) ([b66de08](b66de08))
* **reader-data:** add a CLI command to align reader membership data ([#3548](#3548)) ([8e49bf0](8e49bf0))
* **subscriptions:** add setting to reattempt payment after final retry ([#3560](#3560)) ([553c3ac](553c3ac))
* **woocommerce:** remove internal metadata from REST API response ([6b659a6](6b659a6))
@matticbot
Copy link
Contributor

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

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Dec 9, 2024
# [5.9.0](v5.8.2...v5.9.0) (2024-12-09)

### Bug Fixes

* **emails:** account for false order value ([#3590](#3590)) ([a2e4042](a2e4042))
* **ras-acc:** correct My Account custom font sizing clash ([#3588](#3588)) ([080f1ce](080f1ce))
* **ras-acc:** make helper text size more specific ([#3584](#3584)) ([5bcc688](5bcc688))
* **ras-acc:** re-add recaptcha to the WooCommerce checkout ([#3605](#3605)) ([07f46b3](07f46b3))
* undefined var ([#3585](#3585)) ([00d8bc7](00d8bc7))
* **woocommerce-emails:** use the default email payload if there are no donation products ([#3545](#3545)) ([60c21f3](60c21f3))

### Features

* mark perfmatters as a required plugin ([#3578](#3578)) ([f20291c](f20291c))
* **ras-acc:** add reader account creation and login improvements ([#3582](#3582)) ([b66de08](b66de08))
* **reader-data:** add a CLI command to align reader membership data ([#3548](#3548)) ([8e49bf0](8e49bf0))
* **subscriptions:** add setting to reattempt payment after final retry ([#3560](#3560)) ([553c3ac](553c3ac))
* **woocommerce:** remove internal metadata from REST API response ([6b659a6](6b659a6))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.9.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