Jump to content

[SOLVED] Price Based Shipping?


Presto-X

Recommended Posts

Hello everyone,

 

I'm working on a checkout module and I have the subtotals and totals working great but I need to add price based shipping so if the price is $0.00 to $225.00 the shipping would cost $10.00 ext. ext.

 

This is my code I dont think I'm doing this right???

    if (($subtotal <= "0.00")   ||($subtotal >= "225.00")) {$shipping = "10.00";}
elseif (($subtotal <= "226.00") ||($subtotal >= "550.00")) {$shipping = "20.00";}
elseif (($subtotal <= "551.00") ||($subtotal >= "750.00")) {$shipping = "30.00";}
elseif (($subtotal <= "751.00") ||($subtotal >= "1150.00")){$shipping = "40.00";}
elseif (($subtotal <= "1151.00")||($subtotal >= "2250.00")){$shipping = "67.50";}
elseif (($subtotal <= "2251.00")||($subtotal >= "3250.00")){$shipping = "97.50";}
elseif (($subtotal <= "3251.00")||($subtotal >= "4250.00")){$shipping = "127.50";}
elseif  ($subtotal <= "4251.00")                           {$shipping = "150.00";}

Link to comment
https://forums.phpfreaks.com/topic/149171-solved-price-based-shipping/
Share on other sites

I did test it and it did not work lol

 

Thanks Maq,

 

This is my working code in case others can use it in their project.

 

    if (($subtotal >= '0.00')   &&($subtotal <= '225.00')) {$shipping = '10.00';}
elseif (($subtotal >= '226.00') &&($subtotal <= '550.00')) {$shipping = '20.00';}
elseif (($subtotal >= '551.00') &&($subtotal <= '750.00')) {$shipping = '30.00';}
elseif (($subtotal >= '751.00') &&($subtotal <= '1150.00')){$shipping = '40.00';}
elseif (($subtotal >= '1151.00')&&($subtotal <= '2250.00')){$shipping = '67.50';}
elseif (($subtotal >= '2251.00')&&($subtotal <= '3250.00')){$shipping = '97.50';}
elseif (($subtotal >= '3251.00')&&($subtotal <= '4250.00')){$shipping = '127.50';}
elseif  ($subtotal >= '4251.00')                           {$shipping = '150.00';}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.