simpleCart(js)

items
Items:
Total:

Currency

simpleCart(js) has a number of currencies that are already supported out of the box. You can specify the currency a number of ways, such as setting the option:

simpleCart({
    currency: "GBP" // set the currency to pounds sterling
});

You can also set the currency using the .currency() function:

simpleCart.currency( "EUR" ); // set the currency to Euros

The built-in currencies are listed below, but you can also set a new currency using the .currency() function:

simpleCart.currency({ 
    code: "BTC" ,
    name: "Bitcoin" ,
    symbol: "BTC" 
});

There are a number of formatting options when setting a currency as well. For example, if you wanted your currency to be formatted as 123 456,780 $AWE instead of $123,456.78, you would use:

simpleCart.currency({
    code: "MAC" ,
    name: "My Awesome Currency" ,
    symbol: " $AWE" ,
    delimiter: " " , 
    decimal: "," , 
    after: true ,
    accuracy: 3
});

If you would like to see what the currency is currently set to, you can call the .currency() function with no arguments:

simpleCart.currency("USD");

simpleCart.currency();  // returns { code:"USD", symbol:"$", name:"US Dollar" } 

Built-in currencies:

"USD": { code:"USD", symbol:"$", name:"US Dollar" } , 
"AUD": { code:"AUD", symbol:"$", name:"Australian Dollar" } , 
"BRL": { code:"BRL", symbol:"$", name:"Brazilian Real" } , 
"CAD": { code:"CAD", symbol:"$", name:"Canadian Dollar" } , 
"CZK": { code:"CZK", symbol:" Kč", name:"Czech Koruna", after: true } , 
"DKK": { code:"DKK", symbol:"DKK ", name:"Danish Krone" } , 
"EUR": { code:"EUR", symbol:"€", name:"Euro" } , 
"HKD": { code:"HKD", symbol:"$", name:"Hong Kong Dollar" } ,
"HUF": { code:"HUF", symbol:"Ft", name:"Hungarian Forint" } ,
"ILS": { code:"ILS", symbol:"₪", name:"Israeli New Sheqel" } ,
"JPY": { code:"JPY", symbol:"¥", name:"Japanese Yen" } ,
"MXN": { code:"MXN", symbol:"$", name:"Mexican Peso" } ,
"NOK": { code:"NOK", symbol:"NOK ", name:"Norwegian Krone" } ,
"NZD": { code:"NZD", symbol:"$", name:"New Zealand Dollar" } ,
"PLN": { code:"PLN", symbol:"PLN ", name:"Polish Zloty" } ,
"GBP": { code:"GBP", symbol:"£", name:"Pound Sterling" } ,
"SGD": { code:"SGD", symbol:"$", name:"Singapore Dollar" } ,
"SEK": { code:"SEK", symbol:"SEK ", name:"Swedish Krona" } ,
"CHF": { code:"CHF", symbol:"CHF ", name:"Swiss Franc" } ,
"THB": { code:"THB", symbol:"฿", name:"Thai Baht" } ,
"BTC": { code:"BTC", symbol:" BTC", name:"Bitcoin", accuracy: 4, after: true  }

If there are errors or problems with the default formatting of your currency, please let us know so we can update the base code

 

Comments

  1. Jun 04, 2012

    user10  said:

    Hi.
    Accuracy: and after: work perfect, but custom values for delimeters and decimals (those shown in your example) don’t work for me.

  2. Jul 01, 2012

    kevin  said:

    why there’s no IDR (Indonesian Rupiah) in currency ?

  3. Aug 22, 2012

    Murley  said:

    Hi…
    I want to know can i use any Indian payment gateway with this script… If so then it is useful to me…
    If there are any methods to use Indian Rupee INR to be used as the checkout method using indian payment gateway… Please let me know…

    Thanks
    Murley

  4. Sep 05, 2012

    Christian Nikkanen  said:

    I don’t like the formatting of prices. I know that you use $0.00 in US, but here in Finland and Europe, we prefer 0.00€, and I’m wondering how would I do this.

  5. Oct 17, 2012

    coach outlet  said:

    Wacy: and after: work perfect, but custom values for delimeters and decimals (those shown in your example) don’t work for me.

  6. Oct 18, 2012

    boyan  said:

    hi

    im getting really weird grandtotals for some of my items like
    €21,800000000000001

    and my items are priced like 5,5 2,3 and so on. Is this a known thing? How could i resolve it?

    Many thx

  7. Oct 26, 2012

    worldquest  said:

    How can i make a shopping cart with custom gateway system for my site hosted in weebly.com

Commenting is not available in this channel entry.