WooCommerce PayPal Express Checkout Payment Gateway - Version 1.6.7

Version Description

  • 2019-01-25 =
  • Fix - Error 10413 when using coupons
  • Fix: All variation details when using buttons on product pages are kept
  • Fix: Always render the PayPal buttons in the mini cart
Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce PayPal Express Checkout Payment Gateway
Version 1.6.7
Comparing to
See all releases

Code changes from version 1.6.6 to 1.6.7

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
3
  = 1.6.6 - 2019-01-09 =
4
  * Fix - Discount items were not being included
5
  * Add - Filter for order details to accept decimal quantities of products
1
  *** Changelog ***
2
 
3
+ = 1.6.7 - 2019-01-25 =
4
+ * Fix - Error 10413 when using coupons
5
+ * Fix: All variation details when using buttons on product pages are kept
6
+ * Fix: Always render the PayPal buttons in the mini cart
7
+
8
  = 1.6.6 - 2019-01-09 =
9
  * Fix - Discount items were not being included
10
  * Add - Filter for order details to accept decimal quantities of products
includes/class-wc-gateway-ppec-cart-handler.php CHANGED
@@ -28,6 +28,7 @@ class WC_Gateway_PPEC_Cart_Handler {
28
  } else {
29
  add_action( 'woocommerce_widget_shopping_cart_buttons', array( $this, 'display_mini_paypal_button' ), 20 );
30
  }
 
31
 
32
  if ( 'yes' === wc_gateway_ppec()->settings->checkout_on_single_product_enabled ) {
33
  add_action( 'woocommerce_after_add_to_cart_form', array( $this, 'display_paypal_button_product' ), 1 );
@@ -94,7 +95,7 @@ class WC_Gateway_PPEC_Cart_Handler {
94
  $variation_id = $data_store->find_matching_product_variation( $product, $attributes );
95
  }
96
 
97
- WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id );
98
  } else {
99
  WC()->cart->add_to_cart( $product->get_id(), $qty );
100
  }
@@ -350,8 +351,7 @@ class WC_Gateway_PPEC_Cart_Handler {
350
  }
351
  ?>
352
 
353
- <?php if ( 'yes' === $settings->use_spb ) :
354
- wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' ); ?>
355
  <p class="woocommerce-mini-cart__buttons buttons wcppec-cart-widget-spb">
356
  <span id="woo_pp_ec_button_mini_cart"></span>
357
  </p>
@@ -364,6 +364,17 @@ class WC_Gateway_PPEC_Cart_Handler {
364
  <?php
365
  }
366
 
 
 
 
 
 
 
 
 
 
 
 
367
  /**
368
  * Convert from settings to values expected by PayPal Button API:
369
  * - 'small' button size only allowed if layout is 'vertical'.
28
  } else {
29
  add_action( 'woocommerce_widget_shopping_cart_buttons', array( $this, 'display_mini_paypal_button' ), 20 );
30
  }
31
+ add_action( 'widget_title', array( $this, 'maybe_enqueue_checkout_js' ), 10, 3 );
32
 
33
  if ( 'yes' === wc_gateway_ppec()->settings->checkout_on_single_product_enabled ) {
34
  add_action( 'woocommerce_after_add_to_cart_form', array( $this, 'display_paypal_button_product' ), 1 );
95
  $variation_id = $data_store->find_matching_product_variation( $product, $attributes );
96
  }
97
 
98
+ WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id, $attributes );
99
  } else {
100
  WC()->cart->add_to_cart( $product->get_id(), $qty );
101
  }
351
  }
352
  ?>
353
 
354
+ <?php if ( 'yes' === $settings->use_spb ) : ?>
 
355
  <p class="woocommerce-mini-cart__buttons buttons wcppec-cart-widget-spb">
356
  <span id="woo_pp_ec_button_mini_cart"></span>
357
  </p>
364
  <?php
365
  }
366
 
367
+ public function maybe_enqueue_checkout_js( $widget_title, $widget_instance, $widget_id ) {
368
+ if ( 'woocommerce_widget_cart' === $widget_id ) {
369
+ $gateways = WC()->payment_gateways->get_available_payment_gateways();
370
+ $settings = wc_gateway_ppec()->settings;
371
+ if ( isset( $gateways['ppec_paypal'] ) && 'yes' === $settings->cart_checkout_enabled && 'yes' === $settings->use_spb ) {
372
+ wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' );
373
+ }
374
+ }
375
+ return $widget_title;
376
+ }
377
+
378
  /**
379
  * Convert from settings to values expected by PayPal Button API:
380
  * - 'small' button size only allowed if layout is 'vertical'.
includes/class-wc-gateway-ppec-client.php CHANGED
@@ -577,7 +577,7 @@ class WC_Gateway_PPEC_Client {
577
  if ( $details['total_item_amount'] == $discounts ) {
578
  // Omit line items altogether.
579
  unset( $details['items'] );
580
- } else if ( $discounts > 0 && $discounts < $details['total_item_amount'] ) {
581
  // Else if there is discount, add them to the line-items
582
  $details['items'][] = $this->_get_extra_discount_line_item($discounts);
583
  }
@@ -626,13 +626,13 @@ class WC_Gateway_PPEC_Client {
626
 
627
  /**
628
  * Filter PayPal order details.
629
- *
630
  * Provide opportunity for developers to modify details passed to PayPal.
631
  * This was originally introduced to add a mechanism to allow for
632
  * decimal product quantity support.
633
- *
634
  * @since 1.6.6
635
- *
636
  * @param array $details Current PayPal order details
637
  */
638
  return apply_filters( 'woocommerce_paypal_express_checkout_get_details', $details );
577
  if ( $details['total_item_amount'] == $discounts ) {
578
  // Omit line items altogether.
579
  unset( $details['items'] );
580
+ } else if ( $discounts > 0 && $discounts < $details['total_item_amount'] && ! empty( $details['items'] ) ) {
581
  // Else if there is discount, add them to the line-items
582
  $details['items'][] = $this->_get_extra_discount_line_item($discounts);
583
  }
626
 
627
  /**
628
  * Filter PayPal order details.
629
+ *
630
  * Provide opportunity for developers to modify details passed to PayPal.
631
  * This was originally introduced to add a mechanism to allow for
632
  * decimal product quantity support.
633
+ *
634
  * @since 1.6.6
635
+ *
636
  * @param array $details Current PayPal order details
637
  */
638
  return apply_filters( 'woocommerce_paypal_express_checkout_get_details', $details );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring, pauldechov
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
- Tested up to: 5.0.2
6
- Stable tag: 1.6.6
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -101,6 +101,11 @@ Please use this to inform us about bugs, or make contributions via PRs.
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
104
  = 1.6.6 - 2019-01-09 =
105
  * Fix - Discount items were not being included
106
  * Add - Filter for order details to accept decimal quantities of products
2
  Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring, pauldechov
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
4
  Requires at least: 4.4
5
+ Tested up to: 5.0.3
6
+ Stable tag: 1.6.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
101
 
102
  == Changelog ==
103
 
104
+ = 1.6.7 - 2019-01-25 =
105
+ * Fix - Error 10413 when using coupons
106
+ * Fix: All variation details when using buttons on product pages are kept
107
+ * Fix: Always render the PayPal buttons in the mini cart
108
+
109
  = 1.6.6 - 2019-01-09 =
110
  * Fix - Discount items were not being included
111
  * Add - Filter for order details to accept decimal quantities of products
woocommerce-gateway-paypal-express-checkout.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: A payment gateway for PayPal Checkout (https://www.paypal.com/us/webapps/mpp/paypal-checkout).
6
- * Version: 1.6.6
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2018 WooCommerce / PayPal.
@@ -11,7 +11,7 @@
11
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  * Text Domain: woocommerce-gateway-paypal-express-checkout
13
  * Domain Path: /languages
14
- * WC tested up to: 3.5
15
  * WC requires at least: 2.6
16
  */
17
  /**
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: A payment gateway for PayPal Checkout (https://www.paypal.com/us/webapps/mpp/paypal-checkout).
6
+ * Version: 1.6.7
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2018 WooCommerce / PayPal.
11
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
  * Text Domain: woocommerce-gateway-paypal-express-checkout
13
  * Domain Path: /languages
14
+ * WC tested up to: 3.5.4
15
  * WC requires at least: 2.6
16
  */
17
  /**