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

rszrama’s picture

I 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.

StryKaizer’s picture

At 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

StryKaizer’s picture

StryKaizer’s picture

Assigned: StryKaizer » Unassigned
Status: Active » Needs review
vasike’s picture

Status: Needs review » Needs work

If 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.

StryKaizer’s picture

#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

StryKaizer’s picture

Status: Needs work » Needs review

To 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.

bojanz’s picture

Status: Needs review » Closed (won't fix)

PR closed, see my comment there (hook_install() doesn't have access to the default_country in some cases. Replaced with a Drupal Console command.)