Jump to content

Adding a number to a set value


ImJustBrndn

Recommended Posts

I have a shopping cart system set up and I want to have a button that adds $4.00 to the total if the shipment is going international. I would like to know if there is a "add" command or something like that, that I can have this button point to, to add $4.00 to the total value of the shipment. This is the cart code as far as the money values go.

                        $totalvalue = $totalvalue + ($item["price"]*$ses_quan);
$subtotal = ($item["price"]*$ses_quan);
$shipping = 3.50 + ($totalvalue / 18.00 * 1.00);
$finalvalue = $totalvalue + $shipping

I would like to add $4.00 only on international shipments. Can someone tell me how to go about it and if there is a way to add that as a variable like..  $finalvalue = $totalvalue + $shipping + $international .... But how would I get it to figure the variable international bc I only want it to be $4.00 on certain shipments. Thanks in advance.

Brandon
Link to comment
Share on other sites

The way I would do it -- depending on the cart system -- is look where it defines the tax rate..  then after the tax rate is figured out throw something like this..

if ($location == "international") {
$shipping = ($shipping) + ('4.00');
}

Something similar should work...
Link to comment
Share on other sites

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.