Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript if statement not working ecommerce

The site I'm working on requires that if the total amount is less than 399 then a delivery fee of 100 is to be charged. However I put:

 //<![CDATA[  
simpleCart({    
  if(total<399){shippingFlatRate: 100;}      
}); 
//]]>

the main function has the total amount and that works and flat rate is set on, but when I use this if statement it stays on 0 and doesn't become 100.

like image 909
Imraan AJ Khan Avatar asked Jan 26 '26 01:01

Imraan AJ Khan


1 Answers

If you are trying to set the property of an object then your syntax is wrong. Try this:

shippingFlatRate: total < 399 ? 100 : 0
like image 91
AGB Avatar answered Jan 27 '26 14:01

AGB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!