-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/support postcode restrictions #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
6bb8dd0
ab17a1e
a802af8
bae784a
74827ac
c49330d
97e074c
e3461ca
ec13641
592466e
9075a15
343298f
b1060e2
25667cc
9eed069
2c1c5d5
cb02480
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,8 @@ public function __construct() { | |
|
|
||
| add_action( 'woocommerce_amazon_checkout_init', array( $this, 'checkout_init_common' ) ); | ||
|
|
||
| add_action( 'woocommerce_shipping_zone_before_methods_table', array( $this, 'postcode_explanation_message' ) ); | ||
|
|
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -969,4 +971,50 @@ public function has_other_gateways_enabled() { | |
| } | ||
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Displays an explanation/warning in order to make it clear how Amazon Pay | ||
| * treats postcode restrictions. | ||
| * | ||
| * @param WC_Shipping_Zone $zone | ||
| * @return void | ||
| */ | ||
| public function postcode_explanation_message( $zone ) { | ||
| $pcodes = false; | ||
|
|
||
| foreach ( $zone->get_zone_locations() as $location ) { | ||
| if ( 'postcode' === $location->type ) { | ||
| $pcodes = true; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if ( $pcodes ) : | ||
| ?> | ||
| <div class="notice notice-warning"> | ||
| <p> | ||
| <strong><?php esc_html_e( 'Amazon Pay Notice:', 'woocommerce-gateway-amazon-payments-advanced' ); ?></strong> | ||
| <?php | ||
| /* translators: 1) Opening b tag. 2) Closing b tag. */ | ||
| printf( esc_html__( 'When using postcodes to restrict shipping locations, a selected zone is required for them to apply and they will apply to %1$sall%2$s the selected zones. So please, restrict accordingly.', 'woocommerce-gateway-amazon-payments-advanced' ), '<b>', '</b>' ); | ||
ksere marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ?> | ||
| </p> | ||
| <p> | ||
| <?php | ||
| /* translators: 1) Opening b tag. 2) Closing b tag. */ | ||
| printf( esc_html__( 'Additionally, be careful when specifying ranges. By default WooCommerce supports only %1$sfully numeric ranges%2$s. The same applies for Amazon Pay.', 'woocommerce-gateway-amazon-payments-advanced' ), '<b>', '</b>' ); | ||
ksere marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ?> | ||
| </p> | ||
| <p> | ||
| <?php | ||
| esc_html_e( | ||
| 'Ranges covering thousands or more of postcodes may slow down your site, since Amazon Pay does not support postcode ranges we loop from the minimum until we reach the maximum in order to include them all. Try to use the asterisk (*) wildcard when possible for faster loading times.', | ||
|
||
| 'woocommerce-gateway-amazon-payments-advanced' | ||
| ); | ||
| ?> | ||
| </p> | ||
| </div> | ||
| <?php | ||
| endif; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.