Wanting to get a little sanity check -- in our app...
# support
j
Wanting to get a little sanity check -- in our app we check customer location via IP and then set a session object which represents the currency we'd like to use for the customer. Is there a way we could set that through some mechanism which already exists inside of solidus? I'm looking at the pricing selector classes -- will that work to set the currency for that user globally?
j
You should be using the pricing options mechanism. The pricing options has factory methods for getting the pricing options (which by default includes currency and country) from various contexts, including in the context of a view. You can supply your own pricing options class that works however you like, to compute the pricing options, in this case using the session variable you set.
j
Would that set the correct currency option on the order level too so like order.currency would also automatically sync to the price returned?
j
it won't change existing orders, if that's what you're asking
but the pricing options/price selector control what prices are used everywhere in the system
if you want control over how prices are selected (in any way) they are the only two classes you should need to change (and they are configurable classes)
j
Alright amazing I’m gonna port to them thanks Jared!
sg horns 1