WooCommerce Stripe Payment Gateway - Version 3.1.6

Version Description

  • Fix - TypeError issues on single product page when using Apple Pay on Desktop.
  • Fix - In certain case, Apple Pay on single product page does not show shipping info.
  • Fix - Use store's base location to show/hide accepted credit cards instead of currency.
  • Fix - Unsupported product type when a variable product is added with Apple Pay.
Download this release

Release Info

Developer royho
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 3.1.6
Comparing to
See all releases

Code changes from version 3.1.5 to 3.1.6

assets/js/stripe-apple-pay-single.js CHANGED
@@ -51,14 +51,14 @@ jQuery( function( $ ) {
51
  currencyCode: wc_stripe_apple_pay_single_params.currency_code,
52
  total: {
53
  label: wc_stripe_apple_pay_single_params.label,
54
- amount: 1,
55
  type: 'pending'
56
  },
57
- lineItems: {
58
  label: wc_stripe_apple_pay_single_params.i18n.sub_total,
59
- amount: 1,
60
  type: 'pending'
61
- },
62
  requiredBillingContactFields: ['postalAddress'],
63
  requiredShippingContactFields: 'yes' === wc_stripe_apple_pay_single_params.needs_shipping ? ['postalAddress', 'phone', 'email', 'name'] : ['phone', 'email', 'name']
64
  };
51
  currencyCode: wc_stripe_apple_pay_single_params.currency_code,
52
  total: {
53
  label: wc_stripe_apple_pay_single_params.label,
54
+ amount: '1.00',
55
  type: 'pending'
56
  },
57
+ lineItems: [{
58
  label: wc_stripe_apple_pay_single_params.i18n.sub_total,
59
+ amount: '1.00',
60
  type: 'pending'
61
+ }],
62
  requiredBillingContactFields: ['postalAddress'],
63
  requiredShippingContactFields: 'yes' === wc_stripe_apple_pay_single_params.needs_shipping ? ['postalAddress', 'phone', 'email', 'name'] : ['phone', 'email', 'name']
64
  };
assets/js/stripe-apple-pay-single.min.js CHANGED
@@ -1 +1 @@
1
- Stripe.setPublishableKey(wc_stripe_apple_pay_single_params.key),jQuery(function(a){"use strict";var b={getAjaxURL:function(a){return wc_stripe_apple_pay_single_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){Stripe.applePay.checkAvailability(function(b){b&&a(".apple-pay-button").show()}),a(document.body).on("click",".apple-pay-button",function(c){c.preventDefault();var d=a(".single_add_to_cart_button");if(d.is(".disabled"))return void(d.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):d.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text));var e={countryCode:wc_stripe_apple_pay_single_params.country_code,currencyCode:wc_stripe_apple_pay_single_params.currency_code,total:{label:wc_stripe_apple_pay_single_params.label,amount:1,type:"pending"},lineItems:{label:wc_stripe_apple_pay_single_params.i18n.sub_total,amount:1,type:"pending"},requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:"yes"===wc_stripe_apple_pay_single_params.needs_shipping?["postalAddress","phone","email","name"]:["phone","email","name"]},f=Stripe.applePay.buildSession(e,function(c,d){var e={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_nonce,result:c};a.ajax({type:"POST",data:e,url:b.getAjaxURL("apple_pay"),success:function(b){"true"===b.success&&(d(ApplePaySession.STATUS_SUCCESS),window.location.href=b.redirect),"false"===b.success&&(d(ApplePaySession.STATUS_FAILURE),a(".apple-pay-button").before('<p class="woocommerce-error wc-stripe-apple-pay-error">'+b.msg+"</p>"),a(document.body).animate({scrollTop:a(".wc-stripe-apple-pay-error").offset().top},500))}})},function(c){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_nonce,errors:c.message};a.ajax({type:"POST",data:d,url:b.getAjaxURL("log_apple_pay_errors")})});"yes"===wc_stripe_apple_pay_single_params.needs_shipping&&(f.onshippingcontactselected=function(c){a.when(b.generate_cart()).then(function(){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_get_shipping_methods_nonce,address:c.shippingContact};a.ajax({type:"POST",data:d,url:b.getAjaxURL("apple_pay_get_shipping_methods"),success:function(a){var b={label:wc_stripe_apple_pay_single_params.label,amount:a.total};a.total<=0&&(b.amount=1,b.type="pending"),"true"===a.success&&f.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS,a.shipping_methods,b,a.line_items),"false"===a.success&&f.completeShippingContactSelection(ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,a.shipping_methods,b,a.line_items)}})})},f.onshippingmethodselected=function(c){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_update_shipping_method_nonce,selected_shipping_method:c.shippingMethod};a.ajax({type:"POST",data:d,url:b.getAjaxURL("apple_pay_update_shipping_method"),success:function(a){var b={label:wc_stripe_apple_pay_single_params.label,amount:parseFloat(a.total).toFixed(2)};"true"===a.success&&f.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS,b,a.line_items),"false"===a.success&&f.completeShippingMethodSelection(ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,b,a.line_items)}})}),f.onpaymentmethodselected=function(c){a.when(b.generate_cart()).then(function(){var a={label:wc_stripe_apple_pay_single_params.label,amount:wc_stripe_apple_pay_single_params.total},b=wc_stripe_apple_pay_single_params.line_items;f.completePaymentMethodSelection(a,b)})},f.oncancel=function(a){b.clear_cart()},f.begin()})},get_attributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},generate_cart:function(){var c={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_cart_nonce,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?b.get_attributes().data:[]};return a.ajax({type:"POST",data:c,url:b.getAjaxURL("generate_apple_pay_single"),success:function(a){wc_stripe_apple_pay_single_params.total=a.total,wc_stripe_apple_pay_single_params.line_items=a.line_items}})},clear_cart:function(){var c={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_cart_nonce};return a.ajax({type:"POST",data:c,url:b.getAjaxURL("apple_pay_clear_cart"),success:function(a){}})}};b.init()});
1
+ Stripe.setPublishableKey(wc_stripe_apple_pay_single_params.key),jQuery(function(a){"use strict";var b={getAjaxURL:function(a){return wc_stripe_apple_pay_single_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){Stripe.applePay.checkAvailability(function(b){b&&a(".apple-pay-button").show()}),a(document.body).on("click",".apple-pay-button",function(c){c.preventDefault();var d=a(".single_add_to_cart_button");if(d.is(".disabled"))return void(d.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):d.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text));var e={countryCode:wc_stripe_apple_pay_single_params.country_code,currencyCode:wc_stripe_apple_pay_single_params.currency_code,total:{label:wc_stripe_apple_pay_single_params.label,amount:"1.00",type:"pending"},lineItems:[{label:wc_stripe_apple_pay_single_params.i18n.sub_total,amount:"1.00",type:"pending"}],requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:"yes"===wc_stripe_apple_pay_single_params.needs_shipping?["postalAddress","phone","email","name"]:["phone","email","name"]},f=Stripe.applePay.buildSession(e,function(c,d){var e={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_nonce,result:c};a.ajax({type:"POST",data:e,url:b.getAjaxURL("apple_pay"),success:function(b){"true"===b.success&&(d(ApplePaySession.STATUS_SUCCESS),window.location.href=b.redirect),"false"===b.success&&(d(ApplePaySession.STATUS_FAILURE),a(".apple-pay-button").before('<p class="woocommerce-error wc-stripe-apple-pay-error">'+b.msg+"</p>"),a(document.body).animate({scrollTop:a(".wc-stripe-apple-pay-error").offset().top},500))}})},function(c){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_nonce,errors:c.message};a.ajax({type:"POST",data:d,url:b.getAjaxURL("log_apple_pay_errors")})});"yes"===wc_stripe_apple_pay_single_params.needs_shipping&&(f.onshippingcontactselected=function(c){a.when(b.generate_cart()).then(function(){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_get_shipping_methods_nonce,address:c.shippingContact};a.ajax({type:"POST",data:d,url:b.getAjaxURL("apple_pay_get_shipping_methods"),success:function(a){var b={label:wc_stripe_apple_pay_single_params.label,amount:a.total};a.total<=0&&(b.amount=1,b.type="pending"),"true"===a.success&&f.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS,a.shipping_methods,b,a.line_items),"false"===a.success&&f.completeShippingContactSelection(ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,a.shipping_methods,b,a.line_items)}})})},f.onshippingmethodselected=function(c){var d={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_update_shipping_method_nonce,selected_shipping_method:c.shippingMethod};a.ajax({type:"POST",data:d,url:b.getAjaxURL("apple_pay_update_shipping_method"),success:function(a){var b={label:wc_stripe_apple_pay_single_params.label,amount:parseFloat(a.total).toFixed(2)};"true"===a.success&&f.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS,b,a.line_items),"false"===a.success&&f.completeShippingMethodSelection(ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,b,a.line_items)}})}),f.onpaymentmethodselected=function(c){a.when(b.generate_cart()).then(function(){var a={label:wc_stripe_apple_pay_single_params.label,amount:wc_stripe_apple_pay_single_params.total},b=wc_stripe_apple_pay_single_params.line_items;f.completePaymentMethodSelection(a,b)})},f.oncancel=function(a){b.clear_cart()},f.begin()})},get_attributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},generate_cart:function(){var c={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_cart_nonce,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?b.get_attributes().data:[]};return a.ajax({type:"POST",data:c,url:b.getAjaxURL("generate_apple_pay_single"),success:function(a){wc_stripe_apple_pay_single_params.total=a.total,wc_stripe_apple_pay_single_params.line_items=a.line_items}})},clear_cart:function(){var c={nonce:wc_stripe_apple_pay_single_params.stripe_apple_pay_cart_nonce};return a.ajax({type:"POST",data:c,url:b.getAjaxURL("apple_pay_clear_cart"),success:function(a){}})}};b.init()});
includes/class-wc-gateway-stripe.php CHANGED
@@ -202,7 +202,9 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
202
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard' . $ext ) . '" alt="Mastercard" width="32" ' . $style . ' />';
203
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex' . $ext ) . '" alt="Amex" width="32" ' . $style . ' />';
204
 
205
- if ( 'USD' === get_woocommerce_currency() ) {
 
 
206
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover' . $ext ) . '" alt="Discover" width="32" ' . $style . ' />';
207
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb' . $ext ) . '" alt="JCB" width="32" ' . $style . ' />';
208
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
202
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard' . $ext ) . '" alt="Mastercard" width="32" ' . $style . ' />';
203
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex' . $ext ) . '" alt="Amex" width="32" ' . $style . ' />';
204
 
205
+ $base_location = wc_get_base_location();
206
+
207
+ if ( 'US' === $base_location['country'] ) {
208
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover' . $ext ) . '" alt="Discover" width="32" ' . $style . ' />';
209
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb' . $ext ) . '" alt="JCB" width="32" ' . $style . ' />';
210
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
includes/class-wc-stripe-apple-pay.php CHANGED
@@ -79,6 +79,13 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
79
  */
80
  public $publishable_key;
81
 
 
 
 
 
 
 
 
82
  /**
83
  * Constructor.
84
  *
@@ -107,6 +114,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
107
  $this->apple_pay_button_lang = ! empty( $gateway_settings['apple_pay_button_lang'] ) ? $gateway_settings['apple_pay_button_lang'] : 'en';
108
  $this->logging = ( ! empty( $gateway_settings['logging'] ) && 'yes' === $gateway_settings['logging'] ) ? true : false;
109
  $this->publishable_key = ! empty( $gateway_settings['publishable_key'] ) ? $gateway_settings['publishable_key'] : '';
 
110
 
111
  if ( $this->testmode ) {
112
  $this->publishable_key = ! empty( $gateway_settings['test_publishable_key'] ) ? $gateway_settings['test_publishable_key'] : '';
@@ -115,7 +123,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
115
  $this->init();
116
  }
117
 
118
- public function instance() {
119
  return self::$_this;
120
  }
121
 
@@ -224,6 +232,23 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
224
  return $valid;
225
  }
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  /**
228
  * Enqueue JS scripts and styles for single product page.
229
  *
@@ -260,7 +285,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
260
  'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
261
  'stripe_apple_pay_get_shipping_methods_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_get_shipping_methods_nonce' ),
262
  'stripe_apple_pay_update_shipping_method_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_update_shipping_method_nonce' ),
263
- 'needs_shipping' => $product->needs_shipping() ? 'yes' : 'no',
264
  'i18n' => array(
265
  'sub_total' => __( 'Sub-Total', 'woocommerce-gateway-stripe' ),
266
  ),
@@ -297,7 +322,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
297
  'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
298
  'stripe_apple_pay_get_shipping_methods_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_get_shipping_methods_nonce' ),
299
  'stripe_apple_pay_update_shipping_method_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_update_shipping_method_nonce' ),
300
- 'needs_shipping' => WC()->cart->needs_shipping() ? 'yes' : 'no',
301
  'is_cart_page' => is_cart() ? 'yes' : 'no',
302
  );
303
 
@@ -312,10 +337,11 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
312
  * @return array
313
  */
314
  public function supported_product_types() {
315
- return array(
316
  'simple',
317
  'variable',
318
- );
 
319
  }
320
 
321
  /**
@@ -837,7 +863,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
837
  );
838
  }
839
 
840
- if ( WC()->cart->needs_shipping() ) {
841
  $items[] = array(
842
  'type' => 'final',
843
  'label' => esc_html( __( 'Shipping', 'woocommerce-gateway-stripe' ) ),
@@ -1011,7 +1037,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
1011
 
1012
  // Shipping address.
1013
  $shipping_address = array();
1014
- if ( WC()->cart->needs_shipping() && ! empty( $data['shippingContact'] ) ) {
1015
  $shipping_address['first_name'] = $data['shippingContact']['givenName'];
1016
  $shipping_address['last_name'] = $data['shippingContact']['familyName'];
1017
  $shipping_address['email'] = $data['shippingContact']['emailAddress'];
@@ -1077,6 +1103,10 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
1077
  $order->set_total( WC()->cart->shipping_tax_total, 'shipping_tax' );
1078
  $order->set_total( WC()->cart->total );
1079
 
 
 
 
 
1080
  // If we got here, the order was created without problems!
1081
  wc_transaction_query( 'commit' );
1082
 
79
  */
80
  public $publishable_key;
81
 
82
+ /**
83
+ * Is shipping enabled?
84
+ *
85
+ * @var bool
86
+ */
87
+ public $is_shipping_enabled;
88
+
89
  /**
90
  * Constructor.
91
  *
114
  $this->apple_pay_button_lang = ! empty( $gateway_settings['apple_pay_button_lang'] ) ? $gateway_settings['apple_pay_button_lang'] : 'en';
115
  $this->logging = ( ! empty( $gateway_settings['logging'] ) && 'yes' === $gateway_settings['logging'] ) ? true : false;
116
  $this->publishable_key = ! empty( $gateway_settings['publishable_key'] ) ? $gateway_settings['publishable_key'] : '';
117
+ $this->is_shipping_enabled = $this->is_shipping_enabled();
118
 
119
  if ( $this->testmode ) {
120
  $this->publishable_key = ! empty( $gateway_settings['test_publishable_key'] ) ? $gateway_settings['test_publishable_key'] : '';
123
  $this->init();
124
  }
125
 
126
+ public static function instance() {
127
  return self::$_this;
128
  }
129
 
232
  return $valid;
233
  }
234
 
235
+ /**
236
+ * Checks if shipping is enabled for the store.
237
+ *
238
+ * @since 3.1.6
239
+ * @version 3.1.6
240
+ * @return bool
241
+ */
242
+ public function is_shipping_enabled() {
243
+ $shipping_enabled = get_option( 'woocommerce_ship_to_countries', '' );
244
+
245
+ if ( 'disabled' === $shipping_enabled ) {
246
+ return false;
247
+ }
248
+
249
+ return true;
250
+ }
251
+
252
  /**
253
  * Enqueue JS scripts and styles for single product page.
254
  *
285
  'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
286
  'stripe_apple_pay_get_shipping_methods_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_get_shipping_methods_nonce' ),
287
  'stripe_apple_pay_update_shipping_method_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_update_shipping_method_nonce' ),
288
+ 'needs_shipping' => ( $product->needs_shipping() && $this->is_shipping_enabled ) ? 'yes' : 'no',
289
  'i18n' => array(
290
  'sub_total' => __( 'Sub-Total', 'woocommerce-gateway-stripe' ),
291
  ),
322
  'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
323
  'stripe_apple_pay_get_shipping_methods_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_get_shipping_methods_nonce' ),
324
  'stripe_apple_pay_update_shipping_method_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_update_shipping_method_nonce' ),
325
+ 'needs_shipping' => ( WC()->cart->needs_shipping() && $this->is_shipping_enabled ) ? 'yes' : 'no',
326
  'is_cart_page' => is_cart() ? 'yes' : 'no',
327
  );
328
 
337
  * @return array
338
  */
339
  public function supported_product_types() {
340
+ return apply_filters( 'wc_stripe_apple_pay_supported_types', array(
341
  'simple',
342
  'variable',
343
+ 'variation',
344
+ ) );
345
  }
346
 
347
  /**
863
  );
864
  }
865
 
866
+ if ( WC()->cart->needs_shipping() && $this->is_shipping_enabled ) {
867
  $items[] = array(
868
  'type' => 'final',
869
  'label' => esc_html( __( 'Shipping', 'woocommerce-gateway-stripe' ) ),
1037
 
1038
  // Shipping address.
1039
  $shipping_address = array();
1040
+ if ( WC()->cart->needs_shipping() && $this->is_shipping_enabled && ! empty( $data['shippingContact'] ) ) {
1041
  $shipping_address['first_name'] = $data['shippingContact']['givenName'];
1042
  $shipping_address['last_name'] = $data['shippingContact']['familyName'];
1043
  $shipping_address['email'] = $data['shippingContact']['emailAddress'];
1103
  $order->set_total( WC()->cart->shipping_tax_total, 'shipping_tax' );
1104
  $order->set_total( WC()->cart->total );
1105
 
1106
+ if ( version_compare( WC_VERSION, '3.0', '>=' ) ) {
1107
+ $order->save();
1108
+ }
1109
+
1110
  // If we got here, the order was created without problems!
1111
  wc_transaction_query( 'commit' );
1112
 
includes/legacy/class-wc-gateway-stripe.php CHANGED
@@ -87,7 +87,9 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway {
87
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard' . $ext ) . '" alt="Mastercard" width="32" ' . $style . ' />';
88
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex' . $ext ) . '" alt="Amex" width="32" ' . $style . ' />';
89
 
90
- if ( 'USD' === get_woocommerce_currency() ) {
 
 
91
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover' . $ext ) . '" alt="Discover" width="32" ' . $style . ' />';
92
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb' . $ext ) . '" alt="JCB" width="32" ' . $style . ' />';
93
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
87
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard' . $ext ) . '" alt="Mastercard" width="32" ' . $style . ' />';
88
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/amex' . $ext ) . '" alt="Amex" width="32" ' . $style . ' />';
89
 
90
+ $base_location = wc_get_base_location();
91
+
92
+ if ( 'US' === $base_location['country'] ) {
93
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/discover' . $ext ) . '" alt="Discover" width="32" ' . $style . ' />';
94
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb' . $ext ) . '" alt="JCB" width="32" ' . $style . ' />';
95
  $icon .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext ) . '" alt="Diners" width="32" ' . $style . ' />';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, mikejolley, akeda, royho, mattyza, slash1an
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
  Tested up to: 4.7.2
6
- Stable tag: 3.1.5
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -95,6 +95,12 @@ If you get stuck, you can ask for help in the Plugin Forum.
95
 
96
  == Changelog ==
97
 
 
 
 
 
 
 
98
  = 3.1.5 =
99
  * Add - Check for WP error object in domain verification.
100
 
@@ -170,5 +176,8 @@ If you get stuck, you can ask for help in the Plugin Forum.
170
 
171
  == Upgrade Notice ==
172
 
173
- = 3.1.5 =
174
- * Add - Check for WP error object in domain verification.
 
 
 
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
  Tested up to: 4.7.2
6
+ Stable tag: 3.1.6
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
95
 
96
  == Changelog ==
97
 
98
+ = 3.1.6 =
99
+ * Fix - TypeError issues on single product page when using Apple Pay on Desktop.
100
+ * Fix - In certain case, Apple Pay on single product page does not show shipping info.
101
+ * Fix - Use store's base location to show/hide accepted credit cards instead of currency.
102
+ * Fix - Unsupported product type when a variable product is added with Apple Pay.
103
+
104
  = 3.1.5 =
105
  * Add - Check for WP error object in domain verification.
106
 
176
 
177
  == Upgrade Notice ==
178
 
179
+ = 3.1.6 =
180
+ * Fix - TypeError issues on single product page when using Apple Pay on Desktop.
181
+ * Fix - In certain case, Apple Pay on single product page does not show shipping info.
182
+ * Fix - Use store's base location to show/hide accepted credit cards instead of currency.
183
+ * Fix - Unsupported product type when a variable product is added with Apple Pay.
woocommerce-gateway-stripe.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
- * Version: 3.1.5
9
  * Text Domain: woocommerce-gateway-stripe
10
  * Domain Path: /languages
11
  *
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  /**
33
  * Required minimums and constants
34
  */
35
- define( 'WC_STRIPE_VERSION', '3.1.5' );
36
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
37
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
38
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 3.1.6
9
  * Text Domain: woocommerce-gateway-stripe
10
  * Domain Path: /languages
11
  *
32
  /**
33
  * Required minimums and constants
34
  */
35
+ define( 'WC_STRIPE_VERSION', '3.1.6' );
36
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
37
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
38
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );