Support

Account

Home Forums ACF PRO Set different delivery fee for each group of customers

Unread

Set different delivery fee for each group of customers

  • <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
    <tr class=”fee”>
    <th>
    <?php if($fee->id == ‘delivery’){
    echo “Delivery”;
    } else {
    echo esc_html( $fee->name );
    } ?>
    <?php
    //echo $fee;

    if($fee->id == ‘delivery’){
    if($fee->amount == 0){
    //echo ‘Free Delivery’;
    }else{

    //wc_cart_totals_fee_html( $fee );
    if(WC()->cart->subtotal < 800){
    //echo WC()->cart->subtotal;
    $subData = 800 – WC()->cart->subtotal;
    echo ‘<div>(For free delivery add $’.$subData.’ more to this order)</div>’;
    }
    }
    }else{
    //wc_cart_totals_fee_html( $fee );
    }
    ?>
    </th>
    <td data-title=”<?php echo esc_attr( $fee->name ); ?>”>
    <?php
    //echo $fee;
    if($fee->id == ‘delivery’){
    if($fee->amount == 0){
    echo ‘Free Delivery’;
    }else{

    wc_cart_totals_fee_html( $fee );
    if(WC()->cart->subtotal < 800){

    }
    }
    }else{
    wc_cart_totals_fee_html( $fee );
    }
    ?>
    </td>
    </tr>
    <?php endforeach; ?>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.