Skip to content

The Aelia Multi currency plugin reports an error as Paypal payments is calling it to early #4103

@jane-t

Description

@jane-t

Describe the Bug

When in Debug mode. The Aelia Multi currency plugin reports an error as paypal payments is calling it to early

[19-Feb-2026 09:25:16 UTC] PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wc-aelia-foundation-classes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see ... Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/ddecafaf/store.family-historian.co.uk/wp-includes/functions.php on line 6131

To Reproduce

Install Paypal Payments and Aelia Currency switcher
Turn on Debug
Check Debug,log

Screenshots

Expected Behavior

Actual Behavior

Environment

  • WordPress Version 6.9.1
  • WooCommerce Version 10.5.2
  • Plugin Version 3.4.0
  • Aelia Currency Switcher for WooCommerce Version 5.2.16.251210
  • Aelia Foundation Classes for WooCommerce 2.6.11.251210

Additional Details

This is the response from Aelia

Thanks for the log. The issue seems clear. The flow is the following:
The PayPal Payments plugin is trying to fetch the active currency while loading. This happens before the init event.
Since the active currency depends on the context, the Currency Switcher has to determine it.
As part of this process, our plugin performs a couple of operations and it logs their result, for debugging purposes.
The debug message is passed to the translation functions, as it should be. However, since the whole process started before the init event, WordPress raises the notice, mentioning that the translations have been loaded too early.
You can see all this from the log, in reverse chronological order:
#1 /home/ddecafaf/store.family-historian.co.uk/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters('', Array)
#2 /home/ddecafaf/store.family-historian.co.uk/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#3 /home/ddecafaf/store.family-historian.co.uk/wp-includes/functions.php(6020): do_action('doing_it_wrong_...', '_load_textdomai...', 'Translation loa...', '6.7.0')
#4 /home/ddecafaf/store.family-historian.co.uk/wp-includes/l10n.php(1389): _doing_it_wrong('_load_textdomai...', 'Translation loa...', '6.7.0') // Since the translation was loaded "too early", WordPress raises the notice
#5 /home/ddecafaf/store.family-historian.co.uk/wp-includes/l10n.php(1419): _load_textdomain_just_in_time('woocommerce-ael...')
#6 /home/ddecafaf/store.family-historian.co.uk/wp-includes/l10n.php(195): get_translations_for_domain('woocommerce-ael...')
#7 /home/ddecafaf/store.family-historian.co.uk/wp-includes/l10n.php(307): translate('Attempting to s...', 'woocommerce-ael...')
#8 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-aelia-currencyswitcher/src/lib/classes/settings/wc-aelia-currencies-manager.php(535): __('Attempting to s...', 'woocommerce-ael...') // During the currency detection, the Currency Switcher logs a message, as it should
#9 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-aelia-currencyswitcher/src/plugin-main.php(1027): Aelia\WC\CurrencySwitcher\WC_Aelia_Currencies_Manager->get_currency_by_host('195.200.29.225', 'GBP') // Since the active currency is not yet set, the Currency Switcher runs its geolocation to determine it
#10 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-aelia-currencyswitcher/src/plugin-main.php(461): Aelia\WC\CurrencySwitcher\WC_Aelia_CurrencySwitcher->get_selected_currency() // The Currency Switcher tries to fetch the active currency
#11 /home/ddecafaf/store.family-historian.co.uk/wp-includes/class-wp-hook.php(341): Aelia\WC\CurrencySwitcher\WC_Aelia_CurrencySwitcher->woocommerce_currency('GBP')
#12 /home/ddecafaf/store.family-historian.co.uk/wp-includes/plugin.php(205): WP_Hook->apply_filters('GBP', Array)
#13 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce/includes/wc-core-functions.php(486): apply_filters('woocommerce_cur...', 'GBP')
#14 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Helper/CurrencyGetter.php(22): get_woocommerce_currency() // PayPal Payments is fetching the currency
#15 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-settings/services.php(106): WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencyGetter->get()
#16 /home/ddecafaf/store.family-historian.co.uk/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Inpsyde/Modularity/Container/ReadOnlyContainer.php(46):

How to fix the issue
The proper fix to this issue would be to ensure that the PayPal Payments plugin fetches the currency only after the init event. They already patched a similar issue a while ago (see #3978), the solution is basically the same. You could report this issue to them, with a reference to the ticket I just linked, and they should be able to look into it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions