lunar
lunar copied to clipboard
Exception throwed after add new currency and language
- GetCandy version: 2.0 beta
- Laravel Version: 8.75
- PHP Version: 8.0.10
- Database Driver & Version: Percona Server 5.7 (Mysql)
Expected Behaviour:
Browse the frontend normally
Actual Behaviour:

Steps To Reproduce:
Create a currency and set it as default
Hi @scramatte, most likely this exception occurs because you have not created the product variant price for the new currency you have added.
This is certainly something we need to handle. What the best approach is I'm not sure. I will discuss this tomorrow with the team.
Having discussed this with @alecritson the only sensible approach here is to create the new prices based upon the currency conversion/exchange rate.
A single SQL query can insert over 50k prices in under 5 seconds in our tests, so should be fine. However, we would look to do this via the job queue.
Before a currency can be enabled, it will need all the prices set up. We'll do a simple database check and if the prices are not set up, we will not allow the currency to be enabled. A suitable validation message will be required.
Hi @glennjacobs! This could be an option. Usually when we add new currencies to the system we do so long before the new shop becomes operational for a number of reasons of content organisation and other business arrangements, so another option to add the new currency to the system even without setting a price would be useful. For this reason, in the back-office the unset amount exception for the newly added currency could be handled differently by allowing it to be browsed and set later while it should remain active for the customer side.
@nicolalazzaro Yeah, I thought about that approach. I guess we could make it optional for the system to generate the prices. If they're not generated, then they all need to be manually added before the currency can be enabled.