WooCommerce Square - Version 2.3.3

Version Description

  • 2021.02.09 =
  • Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
  • Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
  • Fix - Allow variable products to be previewed when Square is active. PR#554
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.3.3

assets/js/admin/wc-square-admin-products.coffee CHANGED
@@ -215,8 +215,8 @@ jQuery( document ).ready ( $ ) ->
215
  showError( 'missing_variation_sku' )
216
  else
217
  hideError( 'missing_variation_sku', not hasMultipleAttributes() )
218
- $( syncCheckboxID ).trigger( 'change' )
219
- .trigger 'change'
220
 
221
  else
222
  $( 'input[id^="variable_sku"]' ).off 'change keypress keyup'
@@ -227,7 +227,7 @@ jQuery( document ).ready ( $ ) ->
227
  showError( 'missing_sku' )
228
  else
229
  hideError( 'missing_sku', not hasMultipleAttributes() )
230
- $( syncCheckboxID ).trigger( 'change' )
231
  .trigger 'change'
232
 
233
 
@@ -258,14 +258,12 @@ jQuery( document ).ready ( $ ) ->
258
  ###
259
  triggerUpdate = ->
260
  handleSKU( syncCheckboxID )
261
- $( syncCheckboxID ).trigger 'change'
262
  # handleSKU misses cases where product is variable with no variations
263
  if isVariable() and not $( 'input[id^="variable_sku"]' ).length
264
  showError( 'missing_variation_sku' )
265
 
266
 
267
  # fire once on page load
268
- handleSKU( syncCheckboxID )
269
  handleAttributes( syncCheckboxID )
270
 
271
 
@@ -276,6 +274,7 @@ jQuery( document ).ready ( $ ) ->
276
  ###
277
  $stockFields = $( '.stock_fields' )
278
  $stockInput = $stockFields.find( '#_stock' )
 
279
  $manageField = $( '._manage_stock_field' )
280
  $manageInput = $manageField.find( '#_manage_stock' )
281
  $manageDesc = $manageField.find( '.description' )
@@ -297,7 +296,9 @@ jQuery( document ).ready ( $ ) ->
297
  useSquare = true
298
 
299
  $manageDesc.html( '<a href="' + wc_square_admin_products.settings_url + '">' + wc_square_admin_products.i18n.synced_with_square + '</a>' )
300
- $manageInput.prop( 'disabled', true ).prop( 'checked', not variableProduct ).change()
 
 
301
  $stockInput.prop( 'readonly', true )
302
 
303
  if not variableProduct
@@ -363,6 +364,10 @@ jQuery( document ).ready ( $ ) ->
363
 
364
  if manageStockOriginal
365
  $stockFields.show()
 
 
 
 
366
 
367
 
368
  # handle variations data separately (HTML differs from parent UI!)
@@ -379,7 +384,7 @@ jQuery( document ).ready ( $ ) ->
379
  if useSquare
380
 
381
  # disable stock management inputs
382
- $variationManageInput.prop( 'disabled', true ).prop( 'checked', true ).change()
383
  $variationStockInput.prop( 'readonly', true )
384
  $( '#wc_square_variation_manage_stock' ).prop( 'disabled', false )
385
 
215
  showError( 'missing_variation_sku' )
216
  else
217
  hideError( 'missing_variation_sku', not hasMultipleAttributes() )
218
+ $( syncCheckboxID ).triggerHandler 'change'
219
+ .triggerHandler 'change'
220
 
221
  else
222
  $( 'input[id^="variable_sku"]' ).off 'change keypress keyup'
227
  showError( 'missing_sku' )
228
  else
229
  hideError( 'missing_sku', not hasMultipleAttributes() )
230
+ $( syncCheckboxID ).trigger 'change'
231
  .trigger 'change'
232
 
233
 
258
  ###
259
  triggerUpdate = ->
260
  handleSKU( syncCheckboxID )
 
261
  # handleSKU misses cases where product is variable with no variations
262
  if isVariable() and not $( 'input[id^="variable_sku"]' ).length
263
  showError( 'missing_variation_sku' )
264
 
265
 
266
  # fire once on page load
 
267
  handleAttributes( syncCheckboxID )
268
 
269
 
274
  ###
275
  $stockFields = $( '.stock_fields' )
276
  $stockInput = $stockFields.find( '#_stock' )
277
+ $stockStatus = $( '.stock_status_field' )
278
  $manageField = $( '._manage_stock_field' )
279
  $manageInput = $manageField.find( '#_manage_stock' )
280
  $manageDesc = $manageField.find( '.description' )
296
  useSquare = true
297
 
298
  $manageDesc.html( '<a href="' + wc_square_admin_products.settings_url + '">' + wc_square_admin_products.i18n.synced_with_square + '</a>' )
299
+ $manageInput.prop( 'disabled', true ).prop( 'checked', not variableProduct )
300
+ $stockFields.hide()
301
+ $stockStatus.hide()
302
  $stockInput.prop( 'readonly', true )
303
 
304
  if not variableProduct
364
 
365
  if manageStockOriginal
366
  $stockFields.show()
367
+ $stockStatus.hide()
368
+ else
369
+ $stockStatus.show()
370
+ $stockFields.hide()
371
 
372
 
373
  # handle variations data separately (HTML differs from parent UI!)
384
  if useSquare
385
 
386
  # disable stock management inputs
387
+ $variationManageInput.prop( 'disabled', true ).prop( 'checked', true )
388
  $variationStockInput.prop( 'readonly', true )
389
  $( '#wc_square_variation_manage_stock' ).prop( 'disabled', false )
390
 
assets/js/admin/wc-square-admin-products.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(function(){var e=[].indexOf;jQuery(document).ready(function(i){var r,t,n,a,s,o,c,d,_,u,p,l,f,h,m,k,v,g,w,y,q,b;if(b=null!=(v=window.typenow)?v:"",k=null!=(g=window.pagenow)?g:"","product"===b&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===k&&i("#the-list").on("click",".editinline",function(){var e,r,t;return e=i(this).closest("tr"),t=e.find("th.check-column input").val(),r={action:"wc_square_get_quick_edit_product_details",security:wc_square_admin_products.get_quick_edit_product_details_nonce,product_id:e.find("th.check-column input").val()},i.post(wc_square_admin_products.ajax_url,r,function(e){var r,n,a,s,o,c,d,_,u,p,l,f;if(r=i("tr#edit-"+t),d=r.find("select.square-synced"),n=r.find(".wc-square-sync-with-square-errors"),!e.success&&e.data){if("multiple_attributes"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void n.find(".multiple_attributes").show();if("missing_variation_sku"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void n.find(".missing_variation_sku").show()}return c=r.find("input[name=_sku]"),u=r.find("select[name=_stock_status]"),_=r.find("input[name=_stock]"),o=r.find(".manage_stock_field .manage_stock"),s=r.find("input[name=_manage_stock]"),a='<span class="description"><a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a></span>",p=e.data.edit_url,l=e.data.i18n,f=e.data.is_variable,d.val(e.data.is_synced_with_square),c.on("change keyup keypress",function(e){return""!==i(this).val()||f?(d.prop("disabled",!1),d.trigger("change"),n.find(".missing_sku").hide()):(d.val("no"),d.prop("disabled",!0),n.find(".missing_sku").show())}).trigger("change"),d.on("change",function(e){return"no"===i(this).val()?(s.off(),s.add(_).css({opacity:1}),o.find(".description").remove(),f?s.is(":checked")?(i(".stock_qty_field").show(),i(".backorder_field").show()):i(".stock_status_field").show():(_.prop("readonly",!1),u.prop("readonly",!1))):(s.prop("checked",!0),s.on("click",function(){return!1}),s.add(_).css({opacity:"0.5"}),o.append(a),wc_square_admin_products.is_woocommerce_sor&&p&&l&&o.append('<p class="description"><a href="'+p+'">'+l+"</a></p>"),f?(i(".stock_status_field").hide(),i(".stock_qty_field").hide(),i(".backorder_field").hide()):(_.prop("readonly",!0),u.prop("readonly",!0)))}).trigger("change")})}),"product"===k?(y="#_"+wc_square_admin_products.synced_with_square_taxonomy,f=function(){var r;return r=i("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,r)>=0},_=function(){return""!==i("#_sku").val().trim()},p=function(e){return!!e.length&&e.filter(function(){if(""!==i(this).val().trim())return!0}).length===e.length},u=function(e){var r;return r=e.map(function(e){return i(this).val()}),(r=i.makeArray(r)).every(function(e){return r.indexOf(e)===r.lastIndexOf(e)})},d=function(){var e;return e=i('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),f()&&e&&e.length>1},w=function(e){return i(".wc-square-sync-with-square-error."+e).show(),i(y).prop("disabled",!0),i(y).prop("checked",!1)},l=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(i(".wc-square-sync-with-square-error."+e).hide(),r)return i(y).prop("disabled",!1)},c=function(e){var r;return f()?(i("#_sku").off("change keypress keyup"),l("missing_sku",!d()),(r=i('input[id^="variable_sku"]')).on("change keypress keyup",function(t){return p(r)&&u(r)?l("missing_variation_sku",!d()):w("missing_variation_sku"),i(e).trigger("change")}).trigger("change")):(i('input[id^="variable_sku"]').off("change keypress keyup"),l("missing_variation_sku",!d()),i("#_sku").on("change keypress keyup",function(r){return""===i(this).val().trim()?w("missing_sku"):l("missing_sku",!d()),i(e).trigger("change")}).trigger("change"))},o=function(e){return i("#variable_product_options").on("reload",function(r){return d()?w("multiple_attributes"):l("multiple_attributes",f()?p:_()),i(e).trigger("change")}).trigger("reload")},q=function(){if(c(y),i(y).trigger("change"),f()&&!i('input[id^="variable_sku"]').length)return w("missing_variation_sku")},c(y),o(y),a=i(".stock_fields"),s=a.find("#_stock"),t=i("._manage_stock_field"),n=t.find("#_manage_stock"),r=t.find(".description"),h=r.text(),m=i("#_manage_stock").is(":checked"),i(y).on("change",function(e){var t,o;if(wc_square_admin_products.is_inventory_sync_enabled)return o=-1!==i.inArray(i("#product-type").val(),wc_square_admin_products.variable_product_types),i(this).is(":checked")&&i("#_square_item_variation_id").length>0?(t=!0,r.html('<a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a>"),n.prop("disabled",!0).prop("checked",!o).change(),s.prop("readonly",!0),o||a.show(),wc_square_admin_products.is_woocommerce_sor&&!o?(0===i("p._stock_field span.description").length&&s.after('<span class="description" style="display:block;clear:both;"><a href="#" id="fetch-stock-with-square">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),i("#fetch-stock-with-square").on("click",function(e){var r,t;return e.preventDefault(),(r=i("p._stock_field span.description .spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:i("#post_ID").val()},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,s.val(t),a.find("input[name=_original_stock]").val(t),s.prop("readonly",!1),i("p._stock_field span.description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):wc_square_admin_products.is_square_sor&&0===i("p._stock_field span.description").length&&s.after('<span class="description" style="display:block;clear:both;">'+wc_square_admin_products.i18n.managed_by_square+"</span>")):(t=!1,i("p._stock_field span.description").remove(),s.prop("readonly",!1),r.html(h),n.prop("disabled",!1).prop("checked",m),m&&a.show()),i(".woocommerce_variation").each(function(){var e,r,n,a,s,o;return o=i(this).find("h3 > a").attr("rel"),r=i(this).find("#wc_square_variation_manage_stock"),e=r.parent(),a=i(this).find(".wc_input_stock"),n=a.parent(),t?(r.prop("disabled",!0).prop("checked",!0).change(),a.prop("readonly",!0),i("#wc_square_variation_manage_stock").prop("disabled",!1),0===e.find(".description").length&&r.after('<span class="description">('+wc_square_admin_products.i18n.managed_by_square+")</span>"),wc_square_admin_products.is_woocommerce_sor?(s="fetch-stock-with-square-"+o,0===n.find("span.description").length&&a.after('<span class="description" style="display:block;clear:both;"><a href="#" id="'+s+'">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),i("#"+s).on("click",function(e){var r,t;return e.preventDefault(),(r=i(this).next(".spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:o},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,a.val(t),n.parent().find('input[name^="variable_original_stock"]').val(t),a.prop("readonly",!1),n.find(".description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):void 0):(a.prop("readonly",!1),r.prop("disabled",!1),r.next(".description").remove(),i(this).find("#wc_square_variation_manage_stock").prop("disabled",!0))})}).trigger("change"),i("#product-type").on("change",function(e){return q()}),i("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",function(e){return q()})):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-products.min.js.map
1
+ "use strict";(function(){var e=[].indexOf;jQuery(document).ready(function(i){var r,t,n,a,s,o,c,d,_,u,p,l,f,h,m,k,v,g,w,y,q,b,x;if(x=null!=(g=window.typenow)?g:"",v=null!=(w=window.pagenow)?w:"","product"===x&&wc_square_admin_products.is_product_sync_enabled)return"edit-product"===v&&i("#the-list").on("click",".editinline",function(){var e,r,t;return e=i(this).closest("tr"),t=e.find("th.check-column input").val(),r={action:"wc_square_get_quick_edit_product_details",security:wc_square_admin_products.get_quick_edit_product_details_nonce,product_id:e.find("th.check-column input").val()},i.post(wc_square_admin_products.ajax_url,r,function(e){var r,n,a,s,o,c,d,_,u,p,l,f;if(r=i("tr#edit-"+t),d=r.find("select.square-synced"),n=r.find(".wc-square-sync-with-square-errors"),!e.success&&e.data){if("multiple_attributes"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void n.find(".multiple_attributes").show();if("missing_variation_sku"===e.data)return d.prop("checked",!1),d.prop("disabled",!0),void n.find(".missing_variation_sku").show()}return c=r.find("input[name=_sku]"),u=r.find("select[name=_stock_status]"),_=r.find("input[name=_stock]"),o=r.find(".manage_stock_field .manage_stock"),s=r.find("input[name=_manage_stock]"),a='<span class="description"><a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a></span>",p=e.data.edit_url,l=e.data.i18n,f=e.data.is_variable,d.val(e.data.is_synced_with_square),c.on("change keyup keypress",function(e){return""!==i(this).val()||f?(d.prop("disabled",!1),d.trigger("change"),n.find(".missing_sku").hide()):(d.val("no"),d.prop("disabled",!0),n.find(".missing_sku").show())}).trigger("change"),d.on("change",function(e){return"no"===i(this).val()?(s.off(),s.add(_).css({opacity:1}),o.find(".description").remove(),f?s.is(":checked")?(i(".stock_qty_field").show(),i(".backorder_field").show()):i(".stock_status_field").show():(_.prop("readonly",!1),u.prop("readonly",!1))):(s.prop("checked",!0),s.on("click",function(){return!1}),s.add(_).css({opacity:"0.5"}),o.append(a),wc_square_admin_products.is_woocommerce_sor&&p&&l&&o.append('<p class="description"><a href="'+p+'">'+l+"</a></p>"),f?(i(".stock_status_field").hide(),i(".stock_qty_field").hide(),i(".backorder_field").hide()):(_.prop("readonly",!0),u.prop("readonly",!0)))}).trigger("change")})}),"product"===v?(q="#_"+wc_square_admin_products.synced_with_square_taxonomy,h=function(){var r;return r=i("#product-type").val(),e.call(wc_square_admin_products.variable_product_types,r)>=0},u=function(){return""!==i("#_sku").val().trim()},l=function(e){return!!e.length&&e.filter(function(){if(""!==i(this).val().trim())return!0}).length===e.length},p=function(e){var r;return r=e.map(function(e){return i(this).val()}),(r=i.makeArray(r)).every(function(e){return r.indexOf(e)===r.lastIndexOf(e)})},_=function(){var e;return e=i('.woocommerce_attribute_data input[name^="attribute_variation"]:checked'),h()&&e&&e.length>1},y=function(e){return i(".wc-square-sync-with-square-error."+e).show(),i(q).prop("disabled",!0),i(q).prop("checked",!1)},f=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(i(".wc-square-sync-with-square-error."+e).hide(),r)return i(q).prop("disabled",!1)},d=function(e){var r;return h()?(i("#_sku").off("change keypress keyup"),f("missing_sku",!_()),(r=i('input[id^="variable_sku"]')).on("change keypress keyup",function(t){return l(r)&&p(r)?f("missing_variation_sku",!_()):y("missing_variation_sku"),i(e).triggerHandler("change")}).triggerHandler("change")):(i('input[id^="variable_sku"]').off("change keypress keyup"),f("missing_variation_sku",!_()),i("#_sku").on("change keypress keyup",function(r){return""===i(this).val().trim()?y("missing_sku"):f("missing_sku",!_()),i(e).trigger("change")}).trigger("change"))},c=function(e){return i("#variable_product_options").on("reload",function(r){return _()?y("multiple_attributes"):f("multiple_attributes",h()?l:u()),i(e).trigger("change")}).trigger("reload")},b=function(){if(d(q),h()&&!i('input[id^="variable_sku"]').length)return y("missing_variation_sku")},c(q),a=i(".stock_fields"),s=a.find("#_stock"),o=i(".stock_status_field"),t=i("._manage_stock_field"),n=t.find("#_manage_stock"),r=t.find(".description"),m=r.text(),k=i("#_manage_stock").is(":checked"),i(q).on("change",function(e){var t,c;if(wc_square_admin_products.is_inventory_sync_enabled)return c=-1!==i.inArray(i("#product-type").val(),wc_square_admin_products.variable_product_types),i(this).is(":checked")&&i("#_square_item_variation_id").length>0?(t=!0,r.html('<a href="'+wc_square_admin_products.settings_url+'">'+wc_square_admin_products.i18n.synced_with_square+"</a>"),n.prop("disabled",!0).prop("checked",!c),a.hide(),o.hide(),s.prop("readonly",!0),c||a.show(),wc_square_admin_products.is_woocommerce_sor&&!c?(0===i("p._stock_field span.description").length&&s.after('<span class="description" style="display:block;clear:both;"><a href="#" id="fetch-stock-with-square">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),i("#fetch-stock-with-square").on("click",function(e){var r,t;return e.preventDefault(),(r=i("p._stock_field span.description .spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:i("#post_ID").val()},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,s.val(t),a.find("input[name=_original_stock]").val(t),s.prop("readonly",!1),i("p._stock_field span.description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):wc_square_admin_products.is_square_sor&&0===i("p._stock_field span.description").length&&s.after('<span class="description" style="display:block;clear:both;">'+wc_square_admin_products.i18n.managed_by_square+"</span>")):(t=!1,i("p._stock_field span.description").remove(),s.prop("readonly",!1),r.html(m),n.prop("disabled",!1).prop("checked",k),k?(a.show(),o.hide()):(o.show(),a.hide())),i(".woocommerce_variation").each(function(){var e,r,n,a,s,o;return o=i(this).find("h3 > a").attr("rel"),r=i(this).find("#wc_square_variation_manage_stock"),e=r.parent(),a=i(this).find(".wc_input_stock"),n=a.parent(),t?(r.prop("disabled",!0).prop("checked",!0),a.prop("readonly",!0),i("#wc_square_variation_manage_stock").prop("disabled",!1),0===e.find(".description").length&&r.after('<span class="description">('+wc_square_admin_products.i18n.managed_by_square+")</span>"),wc_square_admin_products.is_woocommerce_sor?(s="fetch-stock-with-square-"+o,0===n.find("span.description").length&&a.after('<span class="description" style="display:block;clear:both;"><a href="#" id="'+s+'">'+wc_square_admin_products.i18n.fetch_stock_with_square+'</a><div class="spinner" style="float:none;"></div></span>'),i("#"+s).on("click",function(e){var r,t;return e.preventDefault(),(r=i(this).next(".spinner")).css("visibility","visible"),t={action:"wc_square_fetch_product_stock_with_square",security:wc_square_admin_products.fetch_product_stock_with_square_nonce,product_id:o},i.post(wc_square_admin_products.ajax_url,t,function(e){var t;return e&&e.success?(t=e.data,a.val(t),n.parent().find('input[name^="variable_original_stock"]').val(t),a.prop("readonly",!1),n.find(".description").remove()):(e.data&&(i(".inventory-fetch-error").remove(),r.after('<span class="inventory-fetch-error" style="display:inline-block;color:red;">'+e.data+"</span>")),r.css("visibility","hidden"),console.log(e))})})):void 0):(a.prop("readonly",!1),r.prop("disabled",!1),r.next(".description").remove(),i(this).find("#wc_square_variation_manage_stock").prop("disabled",!0))})}).trigger("change"),i("#product-type").on("change",function(e){return b()}),i("#woocommerce-product-data").on("woocommerce_variations_loaded woocommerce_variations_added woocommerce_variations_removed",function(e){return b()})):void 0})}).call(void 0);
2
  //# sourceMappingURL=wc-square-admin-products.min.js.map
assets/js/admin/wc-square-admin-products.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["wc-square-admin-products.min.js"],"names":["indexOf","jQuery","document","ready","$","$manageDesc","$manageField","$manageInput","$stockFields","$stockInput","handleAttributes","handleSKU","hasMultipleAttributes","hasSKU","hasUniqueSKUs","hasVariableSKUs","hideError","isVariable","manageDescOriginal","manageStockOriginal","pagenow","ref","ref1","showError","syncCheckboxID","triggerUpdate","typenow","window","wc_square_admin_products","is_product_sync_enabled","on","$row","data","postID","this","closest","find","val","action","security","get_quick_edit_product_details_nonce","product_id","post","ajax_url","response","$editRow","$errors","$manageStockDesc","$manageStockInput","$manageStockLabel","$sku","$squareSynced","$stockQty","$stockStatus","edit_url","i18n","is_variable","success","prop","show","settings_url","synced_with_square","is_synced_with_square","e","trigger","hide","off","add","css","opacity","remove","is","append","is_woocommerce_sor","synced_with_square_taxonomy","ref2","call","variable_product_types","trim","skus","length","filter","skuValues","map","sku","makeArray","every","lastIndexOf","$variation_attributes","error","enable","arguments","undefined","text","useSquare","variableProduct","is_inventory_sync_enabled","inArray","html","change","after","fetch_stock_with_square","$spinner","preventDefault","fetch_product_stock_with_square_nonce","quantity","console","log","is_square_sor","managed_by_square","each","$variationManageField","$variationManageInput","$variationStockField","$variationStockInput","fetchVariationStockActionID","variationID","attr","parent","next"],"mappings":"AAAA,cAEA,WAGE,IAAIA,KAAaA,QAOjBC,OAAOC,UAAUC,MAAM,SAAUC,GAyD/B,IAAIC,EAAaC,EAAcC,EAAcC,EAAcC,EAAaC,EAAkBC,EAAWC,EAAuBC,EAAQC,EAAeC,EAAiBC,EAAWC,EAAYC,EAAoBC,EAAqBC,EAASC,EAAKC,EAAMC,EAAWC,EAAgBC,EAAeC,EAIlS,GAHAA,EAAoC,OAAzBL,EAAMM,OAAOD,SAAmBL,EAAM,GACjDD,EAAqC,OAA1BE,EAAOK,OAAOP,SAAmBE,EAAO,GAE/C,YAAcI,GAIbE,yBAAyBC,wBAuG9B,MAnGI,iBAAmBT,GAErBhB,EAAE,aAAa0B,GAAG,QAAS,cAAe,WACxC,IAAIC,EAAMC,EAAMC,EAQhB,OAPAF,EAAO3B,EAAE8B,MAAMC,QAAQ,MACvBF,EAASF,EAAKK,KAAK,yBAAyBC,MAC5CL,GACEM,OAAQ,2CACRC,SAAUX,yBAAyBY,qCACnCC,WAAYV,EAAKK,KAAK,yBAAyBC,OAE1CjC,EAAEsC,KAAKd,yBAAyBe,SAAUX,EAAM,SAAUY,GAC/D,IAAIC,EAAUC,EAASC,EAAkBC,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3BpC,GACEM,OAAQ,4CACRC,SAAUX,yBAAyB4E,sCACnC/D,WAAY2E,GAEPhH,EAAEsC,KAAKd,yBAAyBe,SAAUX,EAAM,SAAUY,GAC/D,IAAI6D,EACJ,OAAI7D,GAAYA,EAASa,SACvBgD,EAAW7D,EAASZ,KACpBkF,EAAqB7E,IAAIoE,GACzBQ,EAAqBK,SAASlF,KAAK,0CAA0CC,IAAIoE,GACjFS,EAAqBxD,KAAK,YAAY,GAC/BuD,EAAqB7E,KAAK,gBAAgBkC,WAE7C1B,EAASZ,OACX5B,EAAE,0BAA0BkE,SAC5BgC,EAASF,MAAM,+EAAiFxD,EAASZ,KAAO,YAElHsE,EAASlC,IAAI,aAAc,UACpBsC,QAAQC,IAAI/D,cA/B3B,IAsCAsE,EAAqBxD,KAAK,YAAY,GACtCsD,EAAsBtD,KAAK,YAAY,GACvCsD,EAAsBO,KAAK,gBAAgBjD,SACpClE,EAAE8B,MAAME,KAAK,qCAAqCsB,KAAK,YAAY,QAI7EM,QAAQ,UAEX5D,EAAE,iBAAiB0B,GAAG,SAAU,SAAUiC,GACxC,OAAOtC,MAGFrB,EAAE,6BAA6B0B,GAAG,4FAA6F,SAAUiC,GAC9I,OAAOtC,YArPX,MAyPDmD,UAAKgB","file":"wc-square-admin-products.min.js"}
1
+ {"version":3,"sources":["wc-square-admin-products.min.js"],"names":["indexOf","jQuery","document","ready","$","$manageDesc","$manageField","$manageInput","$stockFields","$stockInput","$stockStatus","handleAttributes","handleSKU","hasMultipleAttributes","hasSKU","hasUniqueSKUs","hasVariableSKUs","hideError","isVariable","manageDescOriginal","manageStockOriginal","pagenow","ref","ref1","showError","syncCheckboxID","triggerUpdate","typenow","window","wc_square_admin_products","is_product_sync_enabled","on","$row","data","postID","this","closest","find","val","action","security","get_quick_edit_product_details_nonce","product_id","post","ajax_url","response","$editRow","$errors","$manageStockDesc","$manageStockInput","$manageStockLabel","$sku","$squareSynced","$stockQty","edit_url","i18n","is_variable","success","prop","show","settings_url","synced_with_square","is_synced_with_square","e","trigger","hide","off","add","css","opacity","remove","is","append","is_woocommerce_sor","synced_with_square_taxonomy","ref2","call","variable_product_types","trim","skus","length","filter","skuValues","map","sku","makeArray","every","lastIndexOf","$variation_attributes","error","enable","arguments","undefined","triggerHandler","text","useSquare","variableProduct","is_inventory_sync_enabled","inArray","html","after","fetch_stock_with_square","$spinner","preventDefault","fetch_product_stock_with_square_nonce","quantity","console","log","is_square_sor","managed_by_square","each","$variationManageField","$variationManageInput","$variationStockField","$variationStockInput","fetchVariationStockActionID","variationID","attr","parent","next"],"mappings":"AAAA,cAEA,WAGE,IAAIA,KAAaA,QAOjBC,OAAOC,UAAUC,MAAM,SAAUC,GAyD/B,IAAIC,EAAaC,EAAcC,EAAcC,EAAcC,EAAaC,EAAcC,EAAkBC,EAAWC,EAAuBC,EAAQC,EAAeC,EAAiBC,EAAWC,EAAYC,EAAoBC,EAAqBC,EAASC,EAAKC,EAAMC,EAAWC,EAAgBC,EAAeC,EAIhT,GAHAA,EAAoC,OAAzBL,EAAMM,OAAOD,SAAmBL,EAAM,GACjDD,EAAqC,OAA1BE,EAAOK,OAAOP,SAAmBE,EAAO,GAE/C,YAAcI,GAIbE,yBAAyBC,wBAuG9B,MAnGI,iBAAmBT,GAErBjB,EAAE,aAAa2B,GAAG,QAAS,cAAe,WACxC,IAAIC,EAAMC,EAAMC,EAQhB,OAPAF,EAAO5B,EAAE+B,MAAMC,QAAQ,MACvBF,EAASF,EAAKK,KAAK,yBAAyBC,MAC5CL,GACEM,OAAQ,2CACRC,SAAUX,yBAAyBY,qCACnCC,WAAYV,EAAKK,KAAK,yBAAyBC,OAE1ClC,EAAEuC,KAAKd,yBAAyBe,SAAUX,EAAM,SAAUY,GAC/D,IAAIC,EAAUC,EAASC,EAAkBC,EAAmBC,EAAmBC,EAAMC,EAAeC,EAAW3C,EAAc4C,EAAUC,EAAMC,EAI7I,GAHAV,EAAW1C,EAAE,WAAa8B,GAC1BkB,EAAgBN,EAAST,KAA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yBAAyBe,SAAUX,EAAM,SAAUY,GAC/D,IAAI4D,EACJ,OAAI5D,GAAYA,EAASY,SACvBgD,EAAW5D,EAASZ,KACpBiF,EAAqB5E,IAAImE,GACzBQ,EAAqBK,SAASjF,KAAK,0CAA0CC,IAAImE,GACjFS,EAAqBxD,KAAK,YAAY,GAC/BuD,EAAqB5E,KAAK,gBAAgBiC,WAE7CzB,EAASZ,OACX7B,EAAE,0BAA0BkE,SAC5BgC,EAASF,MAAM,+EAAiFvD,EAASZ,KAAO,YAElHqE,EAASlC,IAAI,aAAc,UACpBsC,QAAQC,IAAI9D,cA/B3B,IAsCAqE,EAAqBxD,KAAK,YAAY,GACtCsD,EAAsBtD,KAAK,YAAY,GACvCsD,EAAsBO,KAAK,gBAAgBjD,SACpClE,EAAE+B,MAAME,KAAK,qCAAqCqB,KAAK,YAAY,QAI7EM,QAAQ,UAEX5D,EAAE,iBAAiB2B,GAAG,SAAU,SAAUgC,GACxC,OAAOrC,MAGFtB,EAAE,6BAA6B2B,GAAG,4FAA6F,SAAUgC,GAC9I,OAAOrC,YA1PX,MA8PDkD,UAAKgB","file":"wc-square-admin-products.min.js"}
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.3.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2021-02-04 05:07:18+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -521,8 +521,8 @@ msgstr ""
521
  msgid "Empty cart"
522
  msgstr ""
523
 
524
- #: includes/Gateway/Digital_Wallet.php:775
525
- msgid "Unable to verify domain - missing access token."
526
  msgstr ""
527
 
528
  #: includes/Gateway/Payment_Form.php:182
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 2.3.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2021-02-09 04:04:57+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
521
  msgid "Empty cart"
522
  msgstr ""
523
 
524
+ #: includes/Gateway/Digital_Wallet.php:780
525
+ msgid "Unable to verify domain with Apple Pay - missing access token."
526
  msgstr ""
527
 
528
  #: includes/Gateway/Payment_Form.php:182
includes/Gateway/Digital_Wallet.php CHANGED
@@ -770,9 +770,14 @@ class Digital_Wallet {
770
  private function register_apple_pay_domain() {
771
  $access_token = $this->gateway->get_plugin()->get_settings_handler()->get_access_token();
772
  $is_sandbox = $this->gateway->get_plugin()->get_settings_handler()->is_sandbox();
 
 
 
 
 
773
 
774
  if ( empty( $access_token ) ) {
775
- throw new Exception( __( 'Unable to verify domain - missing access token.', 'woocommerce-square' ) );
776
  }
777
 
778
  $response = wp_remote_post(
@@ -785,7 +790,7 @@ class Digital_Wallet {
785
  ),
786
  'body' => wp_json_encode(
787
  array(
788
- 'domain_name' => ! empty( $_SERVER['HTTP_HOST'] ) ? wc_clean( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '',
789
  )
790
  ),
791
  )
@@ -793,14 +798,14 @@ class Digital_Wallet {
793
 
794
  if ( is_wp_error( $response ) ) {
795
  /* translators: error message */
796
- throw new \Exception( sprintf( 'Unable to verify domain - %s', $response->get_error_message() ) );
797
  }
798
 
799
  $parsed_response = json_decode( $response['body'], true );
800
 
801
  if ( 200 !== $response['response']['code'] || empty( $parsed_response['status'] ) || 'VERIFIED' !== $parsed_response['status'] ) {
802
  /* translators: error message */
803
- throw new \Exception( sprintf( 'Unable to verify domain - %s', $parsed_response['errors'][0]['detail'] ) );
804
  }
805
  }
806
 
770
  private function register_apple_pay_domain() {
771
  $access_token = $this->gateway->get_plugin()->get_settings_handler()->get_access_token();
772
  $is_sandbox = $this->gateway->get_plugin()->get_settings_handler()->is_sandbox();
773
+ $domain_name = ! empty( $_SERVER['HTTP_HOST'] ) ? wc_clean( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
774
+
775
+ if ( empty( $domain_name ) ) {
776
+ throw new \Exception( 'Unable to verify domain with Apple Pay - no domain found in $_SERVER[\'HTTP_HOST\'].' );
777
+ }
778
 
779
  if ( empty( $access_token ) ) {
780
+ throw new \Exception( __( 'Unable to verify domain with Apple Pay - missing access token.', 'woocommerce-square' ) );
781
  }
782
 
783
  $response = wp_remote_post(
790
  ),
791
  'body' => wp_json_encode(
792
  array(
793
+ 'domain_name' => $domain_name,
794
  )
795
  ),
796
  )
798
 
799
  if ( is_wp_error( $response ) ) {
800
  /* translators: error message */
801
+ throw new \Exception( sprintf( 'Unable to verify domain %s - %s', $domain_name, $response->get_error_message() ) );
802
  }
803
 
804
  $parsed_response = json_decode( $response['body'], true );
805
 
806
  if ( 200 !== $response['response']['code'] || empty( $parsed_response['status'] ) || 'VERIFIED' !== $parsed_response['status'] ) {
807
  /* translators: error message */
808
+ throw new \Exception( sprintf( 'Unable to verify domain %s - response = %s', $domain_name, print_r( $parsed_response, true ) ) ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
809
  }
810
  }
811
 
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.3.2';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
42
 
43
 
44
  /** plugin version number */
45
+ const VERSION = '2.3.3';
46
 
47
  /** plugin ID */
48
  const PLUGIN_ID = 'square';
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.6
6
  Requires PHP: 5.6
7
- Stable tag: 2.3.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -72,6 +72,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
75
  = 2.3.2 - 2021.02.04 =
76
  * Fix - PHP error on the My Account > Payment Methods page when saving a new card. PR#585
77
 
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
+ Stable tag: 2.3.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.3.3 - 2021.02.09 =
76
+ * Fix - Uncaught PHP error when attempting to setup Apple Pay and Square is not properly connected (i.e. no valid access token found). PR#587
77
+ * Fix - Improve error logging when the request to verify the store's domain with Square/Apple Pay fails. PR#587
78
+ * Fix - Allow variable products to be previewed when Square is active. PR#554
79
+
80
  = 2.3.2 - 2021.02.04 =
81
  * Fix - PHP error on the My Account > Payment Methods page when saving a new card. PR#585
82
 
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 2.3.2
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
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 2.3.3
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