[7.0] Only show mobile messaging on Merchant New Order emails (#35025)

Adds a check to the mobile messaging callback to ensure it only gets inserted into the email footer for the New Order notification for merchants, and not for emails sent to customers.

Fixes #35016
This commit is contained in:
Wojciech Zięba 2022-10-10 21:09:50 +02:00 committed by GitHub
parent 84a74b5edb
commit 322f7e8fc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,3 @@
Significance: patch
Type: fix
Comment: This fixes bug described in https://github.com/woocommerce/woocommerce/issues/35016

View File

@ -227,9 +227,11 @@ if ( ! class_exists( 'WC_Email_New_Order' ) ) :
/**
* Add mobile messaging.
*
* @param WC_Email $email that called for mobile messaging. May not contain a WC_Email for legacy reasons.
*/
public function mobile_messaging() {
if ( null !== $this->object ) {
public function mobile_messaging( $email ) {
if ( $email instanceof WC_Email_New_Order && null !== $this->object ) {
$domain = wp_parse_url( home_url(), PHP_URL_HOST );
wc_get_template(
'emails/email-mobile-messaging.php',