Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ public static function is_currency_switched_on_checkout() {
*/
public static function compatible_plugin( $return_name = false ) {

foreach ( self::COMPATIBLE_PLUGINS as $definition_name => $name ) {
/**
* Filter out the compatible plugins to allow external sources to add compatibility.
*
* @since 2.5.1
*/
foreach ( apply_filters( 'woocommerce_amazon_pa_ml_compat_plugins', self::COMPATIBLE_PLUGINS ) as $definition_name => $name ) {
$match = false;
if ( 0 === strpos( $definition_name, 'global' ) ) {
$global_name = str_replace( 'global_', '', $definition_name );
Expand All @@ -155,7 +160,13 @@ public static function compatible_plugin( $return_name = false ) {
$match = true;
}
}
if ( $match ) {

/**
* Filter out whether the compatible plugin has been located in order to allow external plugins to apply their own logic.
*
* @since 2.5.1
*/
if ( apply_filters( 'woocommerce_amazon_pa_matched_compat_plugin_' . $definition_name, $match ) ) {
return ( $return_name ) ? $name : $definition_name;
}
}
Expand Down Expand Up @@ -249,6 +260,14 @@ protected static function init_compatible_plugin_instance( $init = true ) {
require_once 'class-wc-amazon-payments-advanced-multi-currency-wccw.php';
$found_plugin_instance = $init ? new WC_Amazon_Payments_Advanced_Multi_Currency_WCCW() : WC_Amazon_Payments_Advanced_Multi_Currency_WCCW::class;
break;
default:
/**
* Allow external plugins to return their own compatible instance.
*
* @since 2.5.1
*/
$found_plugin_instance = apply_filters( 'woocommerce_amazon_pa_compat_plugin_instance_' . $compatible_plugin, $found_plugin_instance, $init );
break;
}
if ( $init ) {
self::$compatible_instance = $found_plugin_instance;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.