diff --git a/modules/ppcp-axo/extensions.php b/modules/ppcp-axo/extensions.php
index 8d8bf4378..5fd342741 100644
--- a/modules/ppcp-axo/extensions.php
+++ b/modules/ppcp-axo/extensions.php
@@ -126,6 +126,18 @@ return array(
'requirements' => array( 'dcc', 'axo' ),
'gateway' => array( 'dcc', 'axo' ),
),
+ 'axo_shipping_config_notice' => array(
+ 'heading' => '',
+ 'html' => $container->get( 'axo.shipping-config-notice' ),
+ 'type' => 'ppcp-html',
+ 'classes' => array( 'ppcp-field-indent' ),
+ 'class' => array(),
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array( 'dcc', 'axo' ),
+ 'gateway' => array( 'dcc', 'axo' ),
+ ),
'axo_gateway_title' => array(
'title' => __( 'Gateway Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
diff --git a/modules/ppcp-axo/services.php b/modules/ppcp-axo/services.php
index 9d4e6d5fe..399a8b3e3 100644
--- a/modules/ppcp-axo/services.php
+++ b/modules/ppcp-axo/services.php
@@ -25,7 +25,7 @@ return array(
$apm_applies = $container->get( 'axo.helpers.apm-applies' );
assert( $apm_applies instanceof ApmApplies );
- return $apm_applies->for_country_currency() && $apm_applies->for_settings();
+ return $apm_applies->for_country_currency();
},
'axo.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies {
@@ -202,7 +202,6 @@ return array(
return '
';
},
-
'axo.smart-button-location-notice' => static function ( ContainerInterface $container ) : string {
$settings = $container->get( 'wcgateway.settings' );
assert( $settings instanceof Settings );
@@ -230,6 +229,24 @@ return array(
return '';
},
+ 'axo.shipping-config-notice' => static function ( ContainerInterface $container ) : string {
+ $shipping_settings_link = admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' );
+
+ if ( wc_shipping_enabled() && wc_ship_to_billing_address_only() ) {
+ $notice_content = sprintf(
+ /* translators: %1$s: URL to the Shipping destination settings page. */
+ __(
+ 'Warning: The Shipping destination of your store is currently configured to Force shipping to the customer billing address
. To enable Fastlane and accelerate payments, the shipping destination must be configured either to Default to customer shipping address
or Default to customer billing address
so buyers can set separate billing and shipping details.',
+ 'woocommerce-paypal-payments'
+ ),
+ esc_url( $shipping_settings_link )
+ );
+ } else {
+ return '';
+ }
+
+ return '';
+ },
'axo.endpoint.frontend-logger' => static function ( ContainerInterface $container ): FrontendLoggerEndpoint {
return new FrontendLoggerEndpoint(
$container->get( 'button.request-data' ),
diff --git a/modules/ppcp-axo/src/AxoModule.php b/modules/ppcp-axo/src/AxoModule.php
index 3505ff555..6350b5adc 100644
--- a/modules/ppcp-axo/src/AxoModule.php
+++ b/modules/ppcp-axo/src/AxoModule.php
@@ -341,6 +341,7 @@ class AxoModule implements ModuleInterface {
return ! is_user_logged_in()
&& CartCheckoutDetector::has_classic_checkout()
+ && $this->is_compatible_shipping_config()
&& $is_axo_enabled
&& $is_dcc_enabled
&& ! $this->is_excluded_endpoint();
@@ -396,4 +397,13 @@ class AxoModule implements ModuleInterface {
// Exclude the Order Pay endpoint.
return is_wc_endpoint_url( 'order-pay' );
}
+
+ /**
+ * Condition to evaluate if the shipping configuration is compatible.
+ *
+ * @return bool
+ */
+ private function is_compatible_shipping_config(): bool {
+ return ! wc_shipping_enabled() || ( wc_shipping_enabled() && ! wc_ship_to_billing_address_only() );
+ }
}
diff --git a/modules/ppcp-axo/src/Helper/ApmApplies.php b/modules/ppcp-axo/src/Helper/ApmApplies.php
index c5fe645a9..c8a709f55 100644
--- a/modules/ppcp-axo/src/Helper/ApmApplies.php
+++ b/modules/ppcp-axo/src/Helper/ApmApplies.php
@@ -64,19 +64,4 @@ class ApmApplies {
}
return in_array( $this->currency, $this->allowed_country_currency_matrix[ $this->country ], true );
}
-
- /**
- * Returns whether the settings are compatible with AXO.
- *
- * @return bool
- */
- public function for_settings(): bool {
- if ( get_option( 'woocommerce_ship_to_destination' ) === 'billing_only' ) { // Force shipping to the customer billing address.
- return false;
- }
- return true;
- }
-
-
-
}