Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by garyM-10 8 months, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
February 10, 2020 at 2:46 pm #5462615

garyM-10

Tell us what you are trying to do?

The below code inside a plugin was working before with WC but not working after installing WooCommerce multilingual plugin. We have to prevent processing and completed emails to customer for particular order
add_action( 'woocommerce_order_status_processing', 'test_api');

function test_api($order_id){
if($order_id){

add_action( 'woocommerce_email', 'unhook_wph_woocommerce_customer_emails', 10, 1 );
}}

function unhook_wph_woocommerce_customer_emails ($email_class)
{
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );

remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger') );

remove_action( 'woocommerce_order_status_on-hold_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger') );

}

The above code is working without the WCML but after installing WCML, the processing and completed emails are going to customer. Please let me know how to override the WCML to work the code again.

Thanks

February 12, 2020 at 7:35 am #5474657

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

I see that you already talked with my colleague Laura on this ticket:
https://wpml.org/forums/topic/woocommerce-hooks-overwritten-by-wcml/

The root cause for that issue is most likely the same as here, as is the solution. Therefore, can you perhaps when setting up that website, implement this code as well so that our developers can have a look in both cases?

Regards,
Bruno Kos

February 13, 2020 at 11:38 am #5485597

garyM-10

My issue is resolved now. Thank you!