Payment Gateway based fees by WooCommerce
This code is ONLY for the 3.x.x version of the “Advanced Dynamic Pricing for WooCommerce” plugin.
Add provided code to functions.php and update Settings.
Calculation option “Use prices modified by other plugins” must be ON.
System option “Suppress other pricing plugins in frontend” must be OFF.
1 2 3 4 5 6 7 8 9 |
add_action( 'wdp_after_apply_to_wc_cart', function( $cartProcessor, $cart, $wcCart ) { if ( class_exists( 'WC_Add_Fees' ) ) { $wcCart->set_total( max( 0, ( WC_Add_Fees::instance() )->handler_wc_calculated_totals( $wcCart->get_total( 'total' ), $wcCart ) ) ); } }, 10, 3); |