- +62 864 6444 2222
- hi@printshop.com
Orders of $500+ Get Free Shipping
/* add_action('woocommerce_before_calculate_totals', 'tfm_cod_charge_on_payment'); function tfm_cod_charge_on_payment() { // Get the chosen payment method $chosen_payment_method = WC()->session->get('chosen_payment_method'); // Check if the chosen payment method is 'cod' if ($chosen_payment_method == 'cod') { $cart_total = WC()->cart->subtotal; $fees = ((ceil($cart_total * 0.1) / 0.1) + 20) - $cart_total; // Remove any existing 'COD Charge' fee WC()->cart->remove_fee('COD Charge'); // Add a new 'COD Charge' fee with the recalculated amount WC()->cart->add_fee('COD Charge', $fees); } } */ /* // Get the chosen payment gateway $chosen_gateway = WC()->session->get('chosen_payment_method'); $cod_payment_method = 'cod'; // Check if the chosen payment gateway is Cash on Delivery (COD) if ($chosen_gateway === 'cod') { // Add a fee named 'COD Charge' with the calculated fee amount WC()->cart->add_fee('cod', $fees); } } */ //End Custom Codes Here