Modify function in order-functions.php

This topic contains 6 reply and 2 voices, and was last updated by Carlos 8 years, 8 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
August 22, 2015 at 11:58 pm 68653
Carlos Hello, We need to make a change to the function dokan_sync_insert_order called on order-functions.php. What is the proper way to unhook these actions (lines 272 and 273) so we can customize them? add_action( 'woocommerce_checkout_update_order_meta', 'dokan_sync_insert_order' ); add_action( 'dokan_checkout_update_order_meta', 'dokan_sync_insert_order' ); We have tried the following remove_actions, but none of them have worked: global $dokan; remove_action( 'woocommerce_checkout_update_order_meta', array( $dokan, 'dokan_sync_insert_order' )); remove_action( 'dokan_checkout_update_order_meta', array( $dokan, 'dokan_sync_insert_order' )); remove_action( 'woocommerce_checkout_update_order_meta', 'dokan_sync_insert_order' ); remove_action( 'dokan_checkout_update_order_meta', 'dokan_sync_insert_order' ); -------------------- $dokan = WeDevs_Dokan::init(); remove_action( 'woocommerce_checkout_update_order_meta', array( $dokan, 'dokan_sync_insert_order' )); remove_action( 'dokan_checkout_update_order_meta', array( $dokan, 'dokan_sync_insert_order' )); --------------------- Thanks.
August 23, 2015 at 7:01 pm 68741
Nayem Nayem

Hello,

Do you want to override anything?. Then after removing the action you have to add a new action then create a function. In the function, you can override what you want to.

Thanks.

August 23, 2015 at 11:57 pm 68756
Carlos Carlos

Hello,

Yes, we want to override the function. We have a new action that creates the function, but we haven’t been able to make the remove_action work, resulting in duplicate orders.

What is the correct remove_action code we should use to remove dokan_sync_insert_order?

Thanks.

August 24, 2015 at 3:21 pm 68831
Nayem Nayem

Hello,

I have checked and both are working-

remove_action( 'woocommerce_checkout_update_order_meta', 'dokan_sync_insert_order' );
remove_action( 'dokan_checkout_update_order_meta', 'dokan_sync_insert_order' );
August 24, 2015 at 3:53 pm 68839
Carlos Carlos

Hello,

Where are you inserting that code? We have an external plugin that is loading both those lines of code, as well as the other variations we listed earlier, however dokan_sync_insert_order is still being called, resulting in duplicate orders when we call our own instance.

Thanks.

August 24, 2015 at 3:56 pm 68840
Nayem Nayem

You can put those codes in your theme’s function.php file.

August 24, 2015 at 4:08 pm 68841
Carlos Carlos

Thanks for your help. Got it working.

Viewing 6 Posts - 1 through 6 (of 6 total)