Forum

Thread tagged as: Members, Shop

Different shipping rates for different members types

I have a shop installation that sells to both the general public and retailers. The retailers see trade prices – set by assigning a 'wholesale' tag to the member.

The general public get free shipping for everything. But the client would like to charge shipping costs on purchases up to $100 for retailers.

Any suggestions on how to achieve that?

Winston Grace

Winston Grace 0 points

  • 2 years ago

Hi Winston,

I did my slightly convoluted shipping process by making up a number of different shipping_method.html templates. Then I call up the appropriate template from within the shipping.php page. In my case, orders over $300 get free shipping and other shipping rates depend on postcode.


$postcode = perch_shop_order_addresses([], true); // get postcode of customer $cartTotal = perch_shop_cart_total([], true); // get cart total $cartTotalNoCurrency = str_replace('$', '', $cartTotal); // remove dollar sign $cartTotalDollarOnly = str_replace('.00', '', $cartTotalNoCurrency); // remove cents, leave dollar amount only // Check for orders $300 and over - free postage if ( $cartTotalDollarOnly >= 300 ) { echo '<p>You get free postage.</p>'; echo '<p><a href="/checkout-manual.php" class="btn">Pay by bank transfer</a></p>'; echo '<p><a href="/checkout-paypal.php" class="btn">Pay by Paypal</a></p>'; echo '<p><a href="/cancel.php" class="btn">Cancel</a></p>'; } elseif ( $postcode >= 0000 && $postcode <= 1999) { echo '<p>Your postcode is ' . $postcode . ' - the delivery cost will be $20</p>'; perch_shop_shipping_method_form([ 'template' => 'shippings/shipping_form_20.html' ]); } elseif ( $postcode >= 2000 && $postcode <= 2263) { echo '<p>Your postcode is ' . $postcode . ' - the delivery cost will be $10</p>'; perch_shop_shipping_method_form([ 'template' => 'shippings/shipping_form_10.html' ]); } ... and so on.

Thank you Alan, thats got the gears turning in my head on how I will complete this task.