Ended up just disabling the other plugins and adding this to functions.php
/**
* Add a custom fee to COD based on card total
**/
add_action( 'woocommerce_cart_calculate_fees', 'custom_COD_fee', 10, 1 );
function custom_COD_fee ( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
if ( 'cod' === WC()->session->get('chosen_payment_method') ) {
$cart_total = $cart->cart_contents_total;
$current_shipping_cost = WC()->cart->get_shipping_total();
$subtotal = $cart_total + $current_shipping_cost;
$fee = 300;
if ( $subtotal > 10000 ) {
$fee += 100;
}
if ( $subtotal > 30000 ) {
$fee += 200;
}
if ( $subtotal > 100000 ) {
$fee += 400;
}
$cart->add_fee( '代金引換 手数料', $fee, true );
}
}
-
This reply was modified 5 years, 5 months ago by Cody.