Viewing 1 replies (of 1 total)
  • Did you solve this?

    If not try:
    // Calculate service fees

    add_action( ‘woocommerce_cart_calculate_fees’,’woocommerce_custom_surcharge’ );

    function woocommerce_custom_surcharge() {
    global $woocommerce;

    if ( is_admin() && ! defined( ‘DOING_AJAX’ ) )
    return;

    $minimumorder = 20;
    if ($woocommerce->cart->cart_contents_count < $minimumorder){
    $servicefee = 18.00;
    } else {
    $plainfee = .90;
    $servicefee = 0.00;
    // loop through the cart
    foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
    $servicefee += $values[‘quantity’] * $plainfee ;
    }
    }
    }
    $woocommerce->cart->add_fee( ‘Service Fee’, $servicefee, true, ‘standard’ );
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Add variable fee AND fixed fee’ is closed to new replies.