Last active
April 5, 2021 07:29
-
-
Save alamgircsebd/3d721ee96020f39a8818c552016f3ac6 to your computer and use it in GitHub Desktop.
Currency switcher support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add this codes on your parent/child theme functions.php or use custom plugin for add php scripts | |
*/ | |
if ( ! function_exists( 'dokan_woocs_recalculate_order_payment_completed' ) ) { | |
/** | |
* Recalculate order for wc currency switcher support | |
* | |
* @param int $order_id | |
* | |
* @return bool | |
*/ | |
function dokan_woocs_recalculate_order_payment_completed( $order_id ) { | |
if ( class_exists( 'WOOCS' ) ) { | |
global $WOOCS; | |
$WOOCS->recalculate_order( $order_id ); | |
} | |
} | |
} | |
add_action( 'woocommerce_order_status_completed', 'dokan_woocs_recalculate_order_payment_completed', 1 ); | |
add_action( 'woocommerce_payment_complete', 'dokan_woocs_recalculate_order_payment_completed' ); | |
add_filter( 'wp_head', function() { | |
if ( function_exists( 'dokan_is_seller_dashboard' ) && dokan_is_seller_dashboard() && class_exists( 'WOOCS' ) ) { | |
global $WOOCS; | |
$WOOCS->reset_currency(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment