Jump to content

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';}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.