Home›Support›English Support›WCML loads payment gateways too early leading to missing or invalid gateways
WCML loads payment gateways too early leading to missing or invalid gateways
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
WordPress 6.7 has introduced a new issue that impact translations, please update WooCommerce and WPML to the latest versions before you report issues. More about this here - https://wpml.org/errata/php-error-wp-6-7-notice-function-_load_textdomain_just_in_time-was-called/
Background of the issue:
WCML loads woocommerce "get_available_payment_gateways" too early, before conditional tags are loaded, leading to incorrect list of available gateways.
woocommerce calls "is_add_payment_method_page" internally, which is a conditional tag hidden link that is only available on or after the "wp" action
WCML tries to load it on "wp_loaded" though.
You need to change your code to use a later hook (ideally "wp" or later)
Here's a partial stacktrace showing where it goes wrong: