mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
AXO: Remove restriction for the Force shipping to the customer billing address shipping config
This commit is contained in:
parent
f51dbfc6d3
commit
c24b753c38
4 changed files with 1 additions and 47 deletions
|
@ -120,7 +120,6 @@ return array(
|
||||||
'',
|
'',
|
||||||
array(
|
array(
|
||||||
$container->get( 'axo.settings-conflict-notice' ),
|
$container->get( 'axo.settings-conflict-notice' ),
|
||||||
$container->get( 'axo.shipping-config-notice' ),
|
|
||||||
$container->get( 'axo.checkout-config-notice' ),
|
$container->get( 'axo.checkout-config-notice' ),
|
||||||
$container->get( 'axo.incompatible-plugins-notice' ),
|
$container->get( 'axo.incompatible-plugins-notice' ),
|
||||||
)
|
)
|
||||||
|
|
|
@ -180,13 +180,6 @@ return array(
|
||||||
return $settings_notice_generator->generate_checkout_notice();
|
return $settings_notice_generator->generate_checkout_notice();
|
||||||
},
|
},
|
||||||
|
|
||||||
'axo.shipping-config-notice' => static function ( ContainerInterface $container ) : string {
|
|
||||||
$settings_notice_generator = $container->get( 'axo.helpers.settings-notice-generator' );
|
|
||||||
assert( $settings_notice_generator instanceof SettingsNoticeGenerator );
|
|
||||||
|
|
||||||
return $settings_notice_generator->generate_shipping_notice();
|
|
||||||
},
|
|
||||||
|
|
||||||
'axo.incompatible-plugins-notice' => static function ( ContainerInterface $container ) : string {
|
'axo.incompatible-plugins-notice' => static function ( ContainerInterface $container ) : string {
|
||||||
$settings_notice_generator = $container->get( 'axo.helpers.settings-notice-generator' );
|
$settings_notice_generator = $container->get( 'axo.helpers.settings-notice-generator' );
|
||||||
assert( $settings_notice_generator instanceof SettingsNoticeGenerator );
|
assert( $settings_notice_generator instanceof SettingsNoticeGenerator );
|
||||||
|
|
|
@ -99,10 +99,6 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $this->is_compatible_shipping_config() ) {
|
|
||||||
return $methods;
|
|
||||||
}
|
|
||||||
|
|
||||||
$methods[] = $gateway;
|
$methods[] = $gateway;
|
||||||
return $methods;
|
return $methods;
|
||||||
},
|
},
|
||||||
|
@ -173,7 +169,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||||
|| ! $c->get( 'axo.eligible' )
|
|| ! $c->get( 'axo.eligible' )
|
||||||
|| 'continuation' === $c->get( 'button.context' )
|
|| 'continuation' === $c->get( 'button.context' )
|
||||||
|| $subscription_helper->cart_contains_subscription()
|
|| $subscription_helper->cart_contains_subscription()
|
||||||
|| ! $this->is_compatible_shipping_config() ) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +353,6 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||||
|
|
||||||
return ! is_user_logged_in()
|
return ! is_user_logged_in()
|
||||||
&& CartCheckoutDetector::has_classic_checkout()
|
&& CartCheckoutDetector::has_classic_checkout()
|
||||||
&& $this->is_compatible_shipping_config()
|
|
||||||
&& $is_axo_enabled
|
&& $is_axo_enabled
|
||||||
&& $is_dcc_enabled
|
&& $is_dcc_enabled
|
||||||
&& ! $this->is_excluded_endpoint();
|
&& ! $this->is_excluded_endpoint();
|
||||||
|
@ -414,15 +409,6 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||||
return is_wc_endpoint_url( 'order-pay' );
|
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() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a meta tag to allow feature detection on certain pages.
|
* Outputs a meta tag to allow feature detection on certain pages.
|
||||||
*
|
*
|
||||||
|
|
|
@ -103,30 +103,6 @@ class SettingsNoticeGenerator {
|
||||||
return $notice_content ? '<div class="ppcp-notice ppcp-notice-error"><p>' . $notice_content . '</p></div>' : '';
|
return $notice_content ? '<div class="ppcp-notice ppcp-notice-error"><p>' . $notice_content . '</p></div>' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates the shipping notice.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function generate_shipping_notice(): string {
|
|
||||||
$shipping_settings_link = admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' );
|
|
||||||
|
|
||||||
$notice_content = '';
|
|
||||||
|
|
||||||
if ( wc_shipping_enabled() && wc_ship_to_billing_address_only() ) {
|
|
||||||
$notice_content = sprintf(
|
|
||||||
/* translators: %1$s: URL to the Shipping destination settings page. */
|
|
||||||
__(
|
|
||||||
'<span class="highlight">Warning:</span> The <a href="%1$s">Shipping destination</a> of your store is currently configured to <code>Force shipping to the customer billing address</code>. To enable Fastlane and accelerate payments, the shipping destination must be configured either to <code>Default to customer shipping address</code> or <code>Default to customer billing address</code> so buyers can set separate billing and shipping details.',
|
|
||||||
'woocommerce-paypal-payments'
|
|
||||||
),
|
|
||||||
esc_url( $shipping_settings_link )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $notice_content ? '<div class="ppcp-notice ppcp-notice-error"><p>' . $notice_content . '</p></div>' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the incompatible plugins notice.
|
* Generates the incompatible plugins notice.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue