Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Now that https://www.drupal.org/node/2464771 is landed, we can create a default currency based on Drupal's default country in hook_install.
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedI believe we can close this as a duplicate of #2472087: Create a default store in commerce_store_install() unless there's some difference I'm missing.
Comment #2
StryKaizerAt the moment there are 3 default currencies in hook_install in the commerce_price module (USD, EUR, GBP).
Will this code stay, or do we want to swap these with 1 currency based on default country?
If we only want to use the currency-country mapping in hook_install for the commerce_store module, then I'm fine with closing this topic as duplicate
Comment #3
StryKaizerPR at https://github.com/commerceguys/commerce/pull/186
Comment #4
StryKaizerComment #5
vasikeIf i set a country i got
1. blank page on install commerce price
2. second attempt it let me install, but no commerce menu
3. clear cache and i get no currencies : There is no Currency yet.
so maybe it's missing in the code.
Comment #6
StryKaizer#5 did you try this on a clean install? for the PR to work, you need functionality in the commerceguys\intl library which is implemented last week.
I will doublecheck the PR later on a vanilla installation
Comment #7
StryKaizerTo test this patch, you will need to use the dev-version for the commerceguys\intl library.
composer_manager will fetch the intl 0.5 tag, which does not include the required functionality yet.
I just deleted the core/vendor/commerceguys/intl folder and replaced it with the library from https://github.com/commerceguys/intl.
Then I did a clean install with default country "Belgium" which worked for me.
The currency "EUR" was created on installation.
Comment #8
bojanz CreditAttribution: bojanz at Centarro commentedPR closed, see my comment there (hook_install() doesn't have access to the default_country in some cases. Replaced with a Drupal Console command.)