Joy
(@joyously)
The ones you do have aren’t WordPress functions, since WordPress doesn’t have anything about orders. You should ask in the support forum for whatever plugin you are using.
You could use the “wp_mail” filter to check for telltale signs of the target email, like a unique string fragment in the subject. In the same filter callback you can alter the message body. This is a very generic filter, nearly all WP emails go through it. You’d be better off finding one that’s more specific to order confirmations. Doesn’t your current filter callback collect adequate data to determine the nature of the email? Such as by searching for a unique string fragment?
For information specific to your ecommerce plugin, I second Joy’s recommendation.
Hi guys,
Thanks for the feedback, I’d share more context in order to understand better:
Here’s a snapshot of the confirmation order:
https://i.imgur.com/N9Z62Em.png
And current code:
if ( !is_order_received_page() && !is_view_order_page()) {
$_currencies = $this->settings->get_list_currencies();
$_converted_price = number_format(($price * $_currencies["RON"]['rate']), 2, '.', '');
$return = '<span class="woocommerce-Price-amount amount">' . $formatted_price . '</span><span class="converted-price"> ' . $_converted_price . " " . $_currencies["RON"]['custom'] . '</span>';
}
I am displaying two currencies on the site, and when I make the order / payment I send the national currency to the third parties (payment processor & courier).
Since the plugin does not have support for displaying multiple currencies I come up with this customisation but now I have to detect the confirmation e-mail part in order to hide the second currency (since its converted again).
-
This reply was modified 5 years, 11 months ago by
el.severo.
-
This reply was modified 5 years, 11 months ago by
el.severo.
What’s even more strange even if I have the following part:
if ( is_product_category() == true || is_product() == true || is_front_page() == true || is_front_page() == true) {
$_currencies = $this->settings->get_list_currencies();
$_converted_price = number_format(($price * $_currencies["RON"]['rate']), 2, '.', '');
$return = '<span class="woocommerce-Price-amount amount">' . $formatted_price . '</span><span class="converted-price"> ' . $_converted_price . " " . $_currencies["RON"]['custom'] . '</span>';
}
The second currency gets displayed, now I’m wondering how the e-mail part is being built.
Got to the final question:
if(is_front_page()) {
//SHOW ONLY ON HOME PAGE
//BUG: THIS GETS DISPLAYED TO WOOCOMMERCE CONFIRMATION E-MAIL
}
Why this gets displayed to the WooCommerce confirmation e-mail?
-
This reply was modified 5 years, 11 months ago by
el.severo.
I’ve ended up using: class_exists( 'WC_Email' ) and it seems to work.