Code for setting a particular currency to a website from available currencies

Here in the code snippet, it is setting currency value to US dollar from available currencies.

var currObj= {};
                try{
                    if(SC.SESSION){
                        _.each(SC.ENVIRONMENT.availableCurrencies, function (each) {
                            if (each.code == "USD") {
                                //console.log("eachInside", each);
                                currObj = each;
                            }
                        })
                        //console.log("currObj", currObj)
                        SC.SESSION.currency = currObj;
                        console.log("SC.SESSION.currency ", SC.SESSION.currency );
                    }
                }
                catch (e) {
                    console.log("currency_selector err", e)
                }

Leave a comment

Your email address will not be published. Required fields are marked *