Leverage this action hook to add extra fees to the cart. Perfect for handling shipping, taxes, or promotional discounts.
add_action('woocommerce_cart_calculate_fees', 'codebykp_custom_cart_fees');
function codebykp_custom_cart_fees() {
if (WC()->cart->subtotal > 100) {
WC()->cart->add_fee(__('Discount', 'woocommerce'), -10); // Add discount if subtotal exceeds 100
}
}