WooCommerce Square - Version 2.7.0

Version Description

  • 2021.11.09 =
  • New - wc_square_beta_country_support_spain filter to add Spain as a supported country. PR#663
  • Fix - Visibility of digital wallet buttons based on account & privacy settings. PR#652
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Square
Version 2.7.0
Comparing to
See all releases

Code changes from version 2.6.0 to 2.7.0

i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 2.6.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2021-09-29 03:45:38+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -434,7 +434,7 @@ msgid "The sync job has failed. Check sync records, or %s."
434
  msgstr ""
435
 
436
  #: includes/Gateway/API/Requests/Orders.php:84
437
- #: includes/Gateway/Digital_Wallet.php:421
438
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
439
  msgid "Discount"
440
  msgstr ""
@@ -445,7 +445,7 @@ msgid "Adjustment"
445
  msgstr ""
446
 
447
  #: includes/Gateway/Blocks_Handler.php:137
448
- #: includes/Gateway/Digital_Wallet.php:205
449
  #: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:245
450
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
451
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
@@ -467,7 +467,7 @@ msgid ""
467
  "version of WooCommerce Blocks or WooCommerce to fix these issues."
468
  msgstr ""
469
 
470
- #: includes/Gateway/Digital_Wallet.php:110
471
  #. Translators: %1$s: expected location of apple pay verification file, %2$s:
472
  #. opening href tag with link to Square documentation, %3$s: closing href tag
473
  msgid ""
@@ -476,7 +476,7 @@ msgid ""
476
  "information, please read our documentation on %2$sSetting up Apple Pay%3$s."
477
  msgstr ""
478
 
479
- #: includes/Gateway/Digital_Wallet.php:126
480
  #. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
481
  #. expected location of apple pay verification file, %4$s: opening href tag
482
  #. with link to Square documentation, %5$s: closing href tag
@@ -486,61 +486,61 @@ msgid ""
486
  "logs%2$s to find out what caused the registration to fail."
487
  msgstr ""
488
 
489
- #: includes/Gateway/Digital_Wallet.php:174
490
  msgid "OR"
491
  msgstr ""
492
 
493
- #: includes/Gateway/Digital_Wallet.php:274
494
  #. translators: product ID
495
  msgid "Product with the ID (%d) cannot be found."
496
  msgstr ""
497
 
498
- #: includes/Gateway/Digital_Wallet.php:290
499
  #. translators: 1: product name 2: quantity in stock
500
  msgid ""
501
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
502
  "enough stock (%2$s remaining)."
503
  msgstr ""
504
 
505
- #: includes/Gateway/Digital_Wallet.php:295
506
  #. translators: 1: product name
507
  msgid "You cannot purchase \"%1$s\" because it is currently not available."
508
  msgstr ""
509
 
510
- #: includes/Gateway/Digital_Wallet.php:317
511
- #: includes/Gateway/Digital_Wallet.php:413
512
  msgid "Tax"
513
  msgstr ""
514
 
515
- #: includes/Gateway/Digital_Wallet.php:352
516
  msgid "This payment method cannot be used for multiple shipments."
517
  msgstr ""
518
 
519
- #: includes/Gateway/Digital_Wallet.php:363
520
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
521
  msgid "Pending"
522
  msgstr ""
523
 
524
- #: includes/Gateway/Digital_Wallet.php:405
525
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
526
  msgid "Shipping"
527
  msgstr ""
528
 
529
- #: includes/Gateway/Digital_Wallet.php:429
530
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
531
  msgid "Fees"
532
  msgstr ""
533
 
534
- #: includes/Gateway/Digital_Wallet.php:464
535
  #. translators: Context (product, cart, checkout or page)
536
  msgid "Empty payment request data for %s."
537
  msgstr ""
538
 
539
- #: includes/Gateway/Digital_Wallet.php:658
540
  msgid "Empty cart"
541
  msgstr ""
542
 
543
- #: includes/Gateway/Digital_Wallet.php:792
544
  msgid "Unable to verify domain with Apple Pay - missing access token."
545
  msgstr ""
546
 
@@ -717,7 +717,7 @@ msgid ""
717
  "store."
718
  msgstr ""
719
 
720
- #: includes/Gateway.php:1082
721
  msgid " An error occurred, please try again or try an alternate form of payment."
722
  msgstr ""
723
 
@@ -937,7 +937,7 @@ msgid ""
937
  "%5$supdated documentation%6$s."
938
  msgstr ""
939
 
940
- #: includes/Plugin.php:457
941
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
942
  #. 2-character country code, %4$s - comma separated list of 2-character country
943
  #. codes
@@ -946,7 +946,7 @@ msgid ""
946
  "accept transactions from merchants outside of %4$s."
947
  msgstr ""
948
 
949
- #: includes/Plugin.php:484
950
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
951
  #. <a> tag, %4$s - </a> tag
952
  msgid ""
@@ -955,7 +955,7 @@ msgid ""
955
  "successfully with Square. %3$sRead more here%4$s on how to resolve this."
956
  msgstr ""
957
 
958
- #: includes/Plugin.php:527
959
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
960
  #. <a> tag, %4$s - </a> tag
961
  msgid ""
@@ -963,14 +963,14 @@ msgid ""
963
  "Square is inactive. Please disconnect and reconnect to resolve."
964
  msgstr ""
965
 
966
- #: includes/Plugin.php:559
967
  msgid ""
968
  "%1$sWooCommerce Square:%2$s Product prices are entered inclusive of tax, "
969
  "but Square does not support syncing tax-inclusive prices. Please make sure "
970
  "your Square tax rates match your WooCommerce tax rates."
971
  msgstr ""
972
 
973
- #: includes/Plugin.php:590
974
  msgid ""
975
  "Heads up! Your store currency is %1$s but your configured Square business "
976
  "location currency is %2$s, so payments cannot be processed. Please "
@@ -1857,15 +1857,15 @@ msgstr ""
1857
  msgid "Docs"
1858
  msgstr ""
1859
 
1860
- #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:621
1861
  msgid "%1$s - A minimum of %2$s is required."
1862
  msgstr ""
1863
 
1864
- #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:630
1865
  msgid "Set as %1$s - %2$s is required."
1866
  msgstr ""
1867
 
1868
- #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:853
1869
  msgid "Configure"
1870
  msgstr ""
1871
 
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.7.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2021-11-09 04:10:19+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
434
  msgstr ""
435
 
436
  #: includes/Gateway/API/Requests/Orders.php:84
437
+ #: includes/Gateway/Digital_Wallet.php:425
438
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:555
439
  msgid "Discount"
440
  msgstr ""
445
  msgstr ""
446
 
447
  #: includes/Gateway/Blocks_Handler.php:137
448
+ #: includes/Gateway/Digital_Wallet.php:209
449
  #: includes/Gateway/Payment_Form.php:240 includes/Gateway.php:245
450
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php:216
451
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php:2758
467
  "version of WooCommerce Blocks or WooCommerce to fix these issues."
468
  msgstr ""
469
 
470
+ #: includes/Gateway/Digital_Wallet.php:114
471
  #. Translators: %1$s: expected location of apple pay verification file, %2$s:
472
  #. opening href tag with link to Square documentation, %3$s: closing href tag
473
  msgid ""
476
  "information, please read our documentation on %2$sSetting up Apple Pay%3$s."
477
  msgstr ""
478
 
479
+ #: includes/Gateway/Digital_Wallet.php:130
480
  #. Translators: %1$s: opening bold tags, %2$s: closing strong/bold tags, %3$s:
481
  #. expected location of apple pay verification file, %4$s: opening href tag
482
  #. with link to Square documentation, %5$s: closing href tag
486
  "logs%2$s to find out what caused the registration to fail."
487
  msgstr ""
488
 
489
+ #: includes/Gateway/Digital_Wallet.php:178
490
  msgid "OR"
491
  msgstr ""
492
 
493
+ #: includes/Gateway/Digital_Wallet.php:278
494
  #. translators: product ID
495
  msgid "Product with the ID (%d) cannot be found."
496
  msgstr ""
497
 
498
+ #: includes/Gateway/Digital_Wallet.php:294
499
  #. translators: 1: product name 2: quantity in stock
500
  msgid ""
501
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
502
  "enough stock (%2$s remaining)."
503
  msgstr ""
504
 
505
+ #: includes/Gateway/Digital_Wallet.php:299
506
  #. translators: 1: product name
507
  msgid "You cannot purchase \"%1$s\" because it is currently not available."
508
  msgstr ""
509
 
510
+ #: includes/Gateway/Digital_Wallet.php:321
511
+ #: includes/Gateway/Digital_Wallet.php:417
512
  msgid "Tax"
513
  msgstr ""
514
 
515
+ #: includes/Gateway/Digital_Wallet.php:356
516
  msgid "This payment method cannot be used for multiple shipments."
517
  msgstr ""
518
 
519
+ #: includes/Gateway/Digital_Wallet.php:367
520
  #: vendor/prospress/action-scheduler/classes/ActionScheduler_Store.php:182
521
  msgid "Pending"
522
  msgstr ""
523
 
524
+ #: includes/Gateway/Digital_Wallet.php:409
525
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:565
526
  msgid "Shipping"
527
  msgstr ""
528
 
529
+ #: includes/Gateway/Digital_Wallet.php:433
530
  #: vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:575
531
  msgid "Fees"
532
  msgstr ""
533
 
534
+ #: includes/Gateway/Digital_Wallet.php:468
535
  #. translators: Context (product, cart, checkout or page)
536
  msgid "Empty payment request data for %s."
537
  msgstr ""
538
 
539
+ #: includes/Gateway/Digital_Wallet.php:662
540
  msgid "Empty cart"
541
  msgstr ""
542
 
543
+ #: includes/Gateway/Digital_Wallet.php:796
544
  msgid "Unable to verify domain with Apple Pay - missing access token."
545
  msgstr ""
546
 
717
  "store."
718
  msgstr ""
719
 
720
+ #: includes/Gateway.php:1096
721
  msgid " An error occurred, please try again or try an alternate form of payment."
722
  msgstr ""
723
 
937
  "%5$supdated documentation%6$s."
938
  msgstr ""
939
 
940
+ #: includes/Plugin.php:470
941
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
942
  #. 2-character country code, %4$s - comma separated list of 2-character country
943
  #. codes
946
  "accept transactions from merchants outside of %4$s."
947
  msgstr ""
948
 
949
+ #: includes/Plugin.php:497
950
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
951
  #. <a> tag, %4$s - </a> tag
952
  msgid ""
955
  "successfully with Square. %3$sRead more here%4$s on how to resolve this."
956
  msgstr ""
957
 
958
+ #: includes/Plugin.php:540
959
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
960
  #. <a> tag, %4$s - </a> tag
961
  msgid ""
963
  "Square is inactive. Please disconnect and reconnect to resolve."
964
  msgstr ""
965
 
966
+ #: includes/Plugin.php:572
967
  msgid ""
968
  "%1$sWooCommerce Square:%2$s Product prices are entered inclusive of tax, "
969
  "but Square does not support syncing tax-inclusive prices. Please make sure "
970
  "your Square tax rates match your WooCommerce tax rates."
971
  msgstr ""
972
 
973
+ #: includes/Plugin.php:603
974
  msgid ""
975
  "Heads up! Your store currency is %1$s but your configured Square business "
976
  "location currency is %2$s, so payments cannot be processed. Please "
1857
  msgid "Docs"
1858
  msgstr ""
1859
 
1860
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:622
1861
  msgid "%1$s - A minimum of %2$s is required."
1862
  msgstr ""
1863
 
1864
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:631
1865
  msgid "Set as %1$s - %2$s is required."
1866
  msgstr ""
1867
 
1868
+ #: vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-plugin.php:854
1869
  msgid "Configure"
1870
  msgstr ""
1871
 
includes/Gateway.php CHANGED
@@ -886,10 +886,24 @@ class Gateway extends Framework\SV_WC_Payment_Gateway_Direct {
886
  * @return bool
887
  */
888
  public function is_digital_wallet_available() {
889
- $is_available = false;
890
- $base_location = wc_get_base_location();
 
891
 
892
- if ( wc_site_is_https() && in_array( get_woocommerce_currency(), array( 'USD', 'GBP', 'CAD', 'EUR' ), true ) && ( ! empty( $base_location['country'] ) && in_array( $base_location['country'], array( 'US', 'GB', 'CA', 'IE', 'FR' ), true ) ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
893
  $is_available = true;
894
  }
895
 
886
  * @return bool
887
  */
888
  public function is_digital_wallet_available() {
889
+ $is_available = false;
890
+ $base_location = wc_get_base_location();
891
+ $supported_countries = array( 'US', 'GB', 'CA', 'IE', 'FR' );
892
 
893
+ /**
894
+ * Filter to support country: Spain
895
+ *
896
+ * This is only meant for early access.
897
+ *
898
+ * @see https://github.com/woocommerce/woocommerce-square/issues/662
899
+ * @todo Remove this filter once Spain is supported as part
900
+ * of a general release.
901
+ */
902
+ if ( apply_filters( 'wc_square_beta_country_support_spain', false ) ) {
903
+ $supported_countries[] = 'ES';
904
+ }
905
+
906
+ if ( wc_site_is_https() && in_array( get_woocommerce_currency(), array( 'USD', 'GBP', 'CAD', 'EUR' ), true ) && ( ! empty( $base_location['country'] ) && in_array( $base_location['country'], $supported_countries, true ) ) ) {
907
  $is_available = true;
908
  }
909
 
includes/Gateway/Digital_Wallet.php CHANGED
@@ -73,17 +73,21 @@ class Digital_Wallet {
73
  * @since 2.3
74
  */
75
  public function init() {
 
 
 
 
76
  $available_pages = $this->get_available_pages();
77
 
78
- if ( in_array( 'product', $available_pages, true ) ) {
79
  add_action( 'woocommerce_after_add_to_cart_quantity', array( $this, 'render_button' ) );
80
  }
81
 
82
- if ( in_array( 'cart', $available_pages, true ) ) {
83
  add_action( 'woocommerce_proceed_to_checkout', array( $this, 'render_button' ) );
84
  }
85
 
86
- if ( in_array( 'checkout', $available_pages, true ) ) {
87
  add_action( 'woocommerce_before_checkout_form', array( $this, 'render_button' ), 15 );
88
  }
89
 
73
  * @since 2.3
74
  */
75
  public function init() {
76
+ $is_user_logged_in = is_user_logged_in();
77
+ $is_registration_required = WC()->checkout->is_registration_required();
78
+ $is_registration_enabled = WC()->checkout->is_registration_enabled();
79
+
80
  $available_pages = $this->get_available_pages();
81
 
82
+ if ( ( $is_user_logged_in || ! $is_registration_required ) && in_array( 'product', $available_pages, true ) ) {
83
  add_action( 'woocommerce_after_add_to_cart_quantity', array( $this, 'render_button' ) );
84
  }
85
 
86
+ if ( ( $is_user_logged_in || ! $is_registration_required ) && in_array( 'cart', $available_pages, true ) ) {
87
  add_action( 'woocommerce_proceed_to_checkout', array( $this, 'render_button' ) );
88
  }
89
 
90
+ if ( ( $is_user_logged_in || ! $is_registration_required || $is_registration_enabled ) && in_array( 'checkout', $available_pages, true ) ) {
91
  add_action( 'woocommerce_before_checkout_form', array( $this, 'render_button' ), 15 );
92
  }
93
 
includes/Plugin.php CHANGED
@@ -42,7 +42,7 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
42
 
43
 
44
  /** plugin version number */
45
- const VERSION = '2.6.0';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
@@ -447,6 +447,19 @@ class Plugin extends Framework\SV_WC_Payment_Gateway_Plugin {
447
  'FR',
448
  );
449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  $base_location = wc_get_base_location();
451
 
452
  if ( isset( $base_location['country'] ) && ! in_array( $base_location['country'], $accepted_countries, true ) ) {
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.7.0';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
447
  'FR',
448
  );
449
 
450
+ /**
451
+ * Filter to support country: Spain
452
+ *
453
+ * This is only meant for early access.
454
+ *
455
+ * @see https://github.com/woocommerce/woocommerce-square/issues/662
456
+ * @todo Remove this filter once Spain is supported as part
457
+ * of a general release.
458
+ */
459
+ if ( apply_filters( 'wc_square_beta_country_support_spain', false ) ) {
460
+ $accepted_countries[] = 'ES';
461
+ }
462
+
463
  $base_location = wc_get_base_location();
464
 
465
  if ( isset( $base_location['country'] ) && ! in_array( $base_location['country'], $accepted_countries, true ) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 2.6.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -71,6 +71,10 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
 
 
 
 
74
  = 2.6.0 - 2021.09.29 =
75
  * New - Add support for Square stores located in France. PR#650
76
  * Fix - PHP warning when trying to load the Square digital wallet (Apple/Google Pay buttons) on a product page that isn't available for purchase. PR#640
4
  Requires at least: 4.6
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 2.7.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
74
+ = 2.7.0 - 2021.11.09 =
75
+ * New - `wc_square_beta_country_support_spain` filter to add Spain as a supported country. PR#663
76
+ * Fix - Visibility of digital wallet buttons based on account & privacy settings. PR#652
77
+
78
  = 2.6.0 - 2021.09.29 =
79
  * New - Add support for Square stores located in France. PR#650
80
  * Fix - PHP warning when trying to load the Square digital wallet (Apple/Google Pay buttons) on a product page that isn't available for purchase. PR#640
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.6.0
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
@@ -19,7 +19,7 @@
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
- * WC tested up to: 5.7
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.7.0
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
19
  * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
20
  *
21
  * WC requires at least: 3.0
22
+ * WC tested up to: 5.8
23
  */
24
 
25
  defined( 'ABSPATH' ) || exit;