Modify function in order-functions.php
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 | 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 | 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 | Hello, I have checked and both are working-
|
August 24, 2015 at 3:53 pm 68839 | |
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 | You can put those codes in your theme’s function.php file. |
August 24, 2015 at 4:08 pm 68841 | |
Carlos | Thanks for your help. Got it working. |