Abandoned Cart Lite for WooCommerce - Version 5.8.6

Version Description

(12.02.2021) = * Fix - WP Nonce verification being done incorrectly. Fixed the same.

Download this release

Release Info

Developer tychesoftwares
Plugin Icon 128x128 Abandoned Cart Lite for WooCommerce
Version 5.8.6
Comparing to
See all releases

Code changes from version 5.8.5 to 5.8.6

class-wcal-update.php CHANGED
@@ -27,7 +27,7 @@ if ( ! class_exists( 'Wcal_Update' ) ) {
27
  */
28
  public static function wcal_schedule_update_action() {
29
  // IMP: The default value for get option should be updated in each release to match the current version to ensure update code is not run for first time installs.
30
- if ( get_option( 'wcal_previous_version', '5.8.5' ) !== WCAL_PLUGIN_VERSION && function_exists( 'as_enqueue_async_action' ) && false === as_next_scheduled_action( 'wcal_update_db' ) ) {
31
  as_enqueue_async_action( 'wcal_update_db' );
32
  }
33
  }
@@ -90,7 +90,7 @@ if ( ! class_exists( 'Wcal_Update' ) ) {
90
  $wcal_previous_version = get_option( 'wcal_previous_version' );
91
 
92
  if ( wcal_common::wcal_get_version() !== $wcal_previous_version ) {
93
- update_option( 'wcal_previous_version', '5.8.5' );
94
  }
95
  } else { // multi site - child sites.
96
  $wcal_guest_user_id_altered = get_blog_option( $blog_id, 'wcal_guest_user_id_altered' );
@@ -103,7 +103,7 @@ if ( ! class_exists( 'Wcal_Update' ) ) {
103
  $wcal_previous_version = get_blog_option( $blog_id, 'wcal_previous_version' );
104
 
105
  if ( wcal_common::wcal_get_version() !== $wcal_previous_version ) {
106
- update_blog_option( $blog_id, 'wcal_previous_version', '5.8.5' );
107
  }
108
  }
109
 
27
  */
28
  public static function wcal_schedule_update_action() {
29
  // IMP: The default value for get option should be updated in each release to match the current version to ensure update code is not run for first time installs.
30
+ if ( get_option( 'wcal_previous_version', WCAL_PLUGIN_VERSION ) !== WCAL_PLUGIN_VERSION && function_exists( 'as_enqueue_async_action' ) && false === as_next_scheduled_action( 'wcal_update_db' ) ) {
31
  as_enqueue_async_action( 'wcal_update_db' );
32
  }
33
  }
90
  $wcal_previous_version = get_option( 'wcal_previous_version' );
91
 
92
  if ( wcal_common::wcal_get_version() !== $wcal_previous_version ) {
93
+ update_option( 'wcal_previous_version', WCAL_PLUGIN_VERSION );
94
  }
95
  } else { // multi site - child sites.
96
  $wcal_guest_user_id_altered = get_blog_option( $blog_id, 'wcal_guest_user_id_altered' );
103
  $wcal_previous_version = get_blog_option( $blog_id, 'wcal_previous_version' );
104
 
105
  if ( wcal_common::wcal_get_version() !== $wcal_previous_version ) {
106
+ update_blog_option( $blog_id, 'wcal_previous_version', WCAL_PLUGIN_VERSION );
107
  }
108
  }
109
 
includes/frontend/class-wcal-checkout-process.php CHANGED
@@ -393,56 +393,58 @@ if ( ! class_exists( 'Wcal_Checkout_Process' ) ) {
393
 
394
  global $wpdb;
395
 
396
- $order = wc_get_order( $order_id );
 
397
 
398
- $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
399
- $get_sent_email_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed_sent_id', true );
400
 
401
- // Order Status passed in the function is either 'processing' or 'complete' and may or may not reflect the actual order status.
402
- // Hence, always use the status fetched from the order object.
403
- $order_status = ( $order ) ? $order->get_status() : '';
404
 
405
- $wcal_ac_table_name = $wpdb->prefix . 'ac_abandoned_cart_history_lite';
406
- $wcal_email_sent_history_table_name = $wpdb->prefix . 'ac_sent_history_lite';
407
- $wcal_guest_ac_table_name = $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite';
408
 
409
- if ( 'pending' !== $order_status && 'failed' !== $order_status && 'cancelled' !== $order_status && 'trash' !== $order_status ) {
410
- global $wpdb;
411
 
412
- if ( isset( $get_abandoned_id_of_order ) && '' !== $get_abandoned_id_of_order ) {
413
 
414
- $ac_user_id_result = $wpdb->get_results( // phpcs:ignore
415
- $wpdb->prepare(
416
- 'SELECT user_id, abandoned_cart_time FROM `' . $wcal_ac_table_name . '` WHERE id = %d', // phpcs:ignore
417
- $get_abandoned_id_of_order
418
- )
419
- );
420
 
421
- if ( count( $ac_user_id_result ) > 0 ) {
422
- $wcal_user_id = $ac_user_id_result[0]->user_id;
423
 
424
- if ( $wcal_user_id >= 63000000 ) {
425
- add_post_meta( $order_id, 'wcal_abandoned_timestamp', $ac_user_id_result[0]->abandoned_cart_time );
 
 
 
 
 
 
426
 
427
  $wpdb->delete( // phpcs:ignore
428
- $wcal_guest_ac_table_name,
429
- array( 'id' => $wcal_user_id )
430
  );
 
431
  }
432
-
433
- $wpdb->delete( // phpcs:ignore
434
- $wcal_ac_table_name,
435
- array( 'id' => $get_abandoned_id_of_order )
436
- );
437
- delete_post_meta( $order_id, 'wcal_recover_order_placed', $get_abandoned_id_of_order );
438
  }
439
  }
440
- }
441
 
442
- if ( 'pending' !== $woo_order_status && 'failed' !== $woo_order_status && 'cancelled' !== $woo_order_status && 'trash' !== $woo_order_status ) {
443
 
444
- if ( isset( $get_sent_email_id_of_order ) && '' !== $get_sent_email_id_of_order ) {
445
- $this->wcal_updated_recovered_cart( $get_abandoned_id_of_order, $order_id, $get_sent_email_id_of_order, $order );
 
446
  }
447
  }
448
 
393
 
394
  global $wpdb;
395
 
396
+ if ( $order_id > 0 ) {
397
+ $order = wc_get_order( $order_id );
398
 
399
+ $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
400
+ $get_sent_email_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed_sent_id', true );
401
 
402
+ // Order Status passed in the function is either 'processing' or 'complete' and may or may not reflect the actual order status.
403
+ // Hence, always use the status fetched from the order object.
404
+ $order_status = ( $order ) ? $order->get_status() : '';
405
 
406
+ $wcal_ac_table_name = $wpdb->prefix . 'ac_abandoned_cart_history_lite';
407
+ $wcal_email_sent_history_table_name = $wpdb->prefix . 'ac_sent_history_lite';
408
+ $wcal_guest_ac_table_name = $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite';
409
 
410
+ if ( 'pending' !== $order_status && 'failed' !== $order_status && 'cancelled' !== $order_status && 'trash' !== $order_status ) {
411
+ global $wpdb;
412
 
413
+ if ( isset( $get_abandoned_id_of_order ) && '' !== $get_abandoned_id_of_order ) {
414
 
415
+ $ac_user_id_result = $wpdb->get_results( // phpcs:ignore
416
+ $wpdb->prepare(
417
+ 'SELECT user_id, abandoned_cart_time FROM `' . $wcal_ac_table_name . '` WHERE id = %d', // phpcs:ignore
418
+ $get_abandoned_id_of_order
419
+ )
420
+ );
421
 
422
+ if ( count( $ac_user_id_result ) > 0 ) {
423
+ $wcal_user_id = $ac_user_id_result[0]->user_id;
424
 
425
+ if ( $wcal_user_id >= 63000000 ) {
426
+ add_post_meta( $order_id, 'wcal_abandoned_timestamp', $ac_user_id_result[0]->abandoned_cart_time );
427
+
428
+ $wpdb->delete( // phpcs:ignore
429
+ $wcal_guest_ac_table_name,
430
+ array( 'id' => $wcal_user_id )
431
+ );
432
+ }
433
 
434
  $wpdb->delete( // phpcs:ignore
435
+ $wcal_ac_table_name,
436
+ array( 'id' => $get_abandoned_id_of_order )
437
  );
438
+ delete_post_meta( $order_id, 'wcal_recover_order_placed', $get_abandoned_id_of_order );
439
  }
 
 
 
 
 
 
440
  }
441
  }
 
442
 
443
+ if ( 'pending' !== $woo_order_status && 'failed' !== $woo_order_status && 'cancelled' !== $woo_order_status && 'trash' !== $woo_order_status ) {
444
 
445
+ if ( isset( $get_sent_email_id_of_order ) && '' !== $get_sent_email_id_of_order ) {
446
+ $this->wcal_updated_recovered_cart( $get_abandoned_id_of_order, $order_id, $get_sent_email_id_of_order, $order );
447
+ }
448
  }
449
  }
450
 
readme.txt CHANGED
@@ -222,6 +222,8 @@ The admin can use the merge code `{{cart.unsubscribe}}' in the email templates.
222
  6. Product Report Tab.
223
 
224
  == Changelog ==
 
 
225
 
226
  = 5.8.5 (27.01.2021) =
227
  * Tweak - Added a hook to modify the email to which recovery emails are sent. Comma separated email addresses can be added.
222
  6. Product Report Tab.
223
 
224
  == Changelog ==
225
+ = 5.8.6 (12.02.2021) =
226
+ * Fix - WP Nonce verification being done incorrectly. Fixed the same.
227
 
228
  = 5.8.5 (27.01.2021) =
229
  * Tweak - Added a hook to modify the email to which recovery emails are sent. Comma separated email addresses can be added.
woocommerce-ac.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: Abandoned Cart Lite for WooCommerce
4
  * Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
  * Description: This plugin captures abandoned carts by logged-in users & emails them about it. <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the PRO Version.</a></strong>
6
- * Version: 5.8.5
7
  * Author: Tyche Softwares
8
  * Author URI: http://www.tychesoftwares.com/
9
  * Text Domain: woocommerce-abandoned-cart
10
  * Domain Path: /i18n/languages/
11
  * Requires PHP: 5.6
12
  * WC requires at least: 3.0.0
13
- * WC tested up to: 4.9.1
14
  *
15
  * @package Abandoned-Cart-Lite-for-WooCommerce
16
  */
@@ -118,7 +118,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
118
  }
119
 
120
  if ( ! defined( 'WCAL_PLUGIN_VERSION' ) ) {
121
- define( 'WCAL_PLUGIN_VERSION', '5.8.5' );
122
  }
123
  $this->one_hour = 60 * 60;
124
  $this->three_hours = 3 * $this->one_hour;
@@ -409,7 +409,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
409
  }
410
 
411
  if ( isset( $_GET['wcal_preview_woocommerce_mail'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
412
- if ( isset( $_REQUEST['_wpnonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'woocommerce-abandoned-cart' ) ) {
413
  die( 'Security check' );
414
  }
415
  $message = '';
@@ -446,7 +446,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
446
  }
447
 
448
  if ( isset( $_GET['wcal_preview_mail'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
449
- if ( isset( $_REQUEST['_wpnonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'woocommerce-abandoned-cart' ) ) {
450
  die( 'Security check' );
451
  }
452
  // get the preview email content.
@@ -1737,26 +1737,28 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1737
  $tax_total = 0;
1738
  if ( count( $saved_cart ) > 0 ) {
1739
  foreach ( $saved_cart as $key => $value ) {
1740
- foreach ( $value as $a => $b ) {
1741
- $c['product_id'] = $b['product_id'];
1742
- $c['variation_id'] = $b['variation_id'];
1743
- $c['variation'] = $b['variation'];
1744
- $c['quantity'] = $b['quantity'];
1745
- $product_id = $b['product_id'];
1746
- $c['data'] = wc_get_product( $product_id );
1747
- $c['line_total'] = $b['line_total'];
1748
- $c['line_tax'] = $cart_contents_tax;
1749
- $c['line_subtotal'] = $b['line_subtotal'];
1750
- $c['line_subtotal_tax'] = $cart_contents_tax;
1751
- $value_new[ $a ] = $c;
1752
- $cart_contents_total = $b['line_subtotal'] + $cart_contents_total;
1753
- $cart_contents_count = $cart_contents_count + $b['quantity'];
1754
- $total = $total + $b['line_total'];
1755
- $subtotal = $subtotal + $b['line_subtotal'];
1756
- $subtotal_ex_tax = $subtotal_ex_tax + $b['line_subtotal'];
 
 
 
 
1757
  }
1758
- $saved_cart_data[ $key ] = $value_new;
1759
- $woocommerce_cart_hash = $a;
1760
  }
1761
  }
1762
 
3
  * Plugin Name: Abandoned Cart Lite for WooCommerce
4
  * Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
  * Description: This plugin captures abandoned carts by logged-in users & emails them about it. <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the PRO Version.</a></strong>
6
+ * Version: 5.8.6
7
  * Author: Tyche Softwares
8
  * Author URI: http://www.tychesoftwares.com/
9
  * Text Domain: woocommerce-abandoned-cart
10
  * Domain Path: /i18n/languages/
11
  * Requires PHP: 5.6
12
  * WC requires at least: 3.0.0
13
+ * WC tested up to: 5.0.0
14
  *
15
  * @package Abandoned-Cart-Lite-for-WooCommerce
16
  */
118
  }
119
 
120
  if ( ! defined( 'WCAL_PLUGIN_VERSION' ) ) {
121
+ define( 'WCAL_PLUGIN_VERSION', '5.8.6' );
122
  }
123
  $this->one_hour = 60 * 60;
124
  $this->three_hours = 3 * $this->one_hour;
409
  }
410
 
411
  if ( isset( $_GET['wcal_preview_woocommerce_mail'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
412
+ if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'woocommerce-abandoned-cart' ) ) {
413
  die( 'Security check' );
414
  }
415
  $message = '';
446
  }
447
 
448
  if ( isset( $_GET['wcal_preview_mail'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
449
+ if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'woocommerce-abandoned-cart' ) ) {
450
  die( 'Security check' );
451
  }
452
  // get the preview email content.
1737
  $tax_total = 0;
1738
  if ( count( $saved_cart ) > 0 ) {
1739
  foreach ( $saved_cart as $key => $value ) {
1740
+ if ( count( $value ) > 0 ) {
1741
+ foreach ( $value as $a => $b ) {
1742
+ $c['product_id'] = $b['product_id'];
1743
+ $c['variation_id'] = $b['variation_id'];
1744
+ $c['variation'] = $b['variation'];
1745
+ $c['quantity'] = $b['quantity'];
1746
+ $product_id = $b['product_id'];
1747
+ $c['data'] = wc_get_product( $product_id );
1748
+ $c['line_total'] = $b['line_total'];
1749
+ $c['line_tax'] = $cart_contents_tax;
1750
+ $c['line_subtotal'] = $b['line_subtotal'];
1751
+ $c['line_subtotal_tax'] = $cart_contents_tax;
1752
+ $value_new[ $a ] = $c;
1753
+ $cart_contents_total = $b['line_subtotal'] + $cart_contents_total;
1754
+ $cart_contents_count = $cart_contents_count + $b['quantity'];
1755
+ $total = $total + $b['line_total'];
1756
+ $subtotal = $subtotal + $b['line_subtotal'];
1757
+ $subtotal_ex_tax = $subtotal_ex_tax + $b['line_subtotal'];
1758
+ }
1759
+ $saved_cart_data[ $key ] = $value_new;
1760
+ $woocommerce_cart_hash = $a;
1761
  }
 
 
1762
  }
1763
  }
1764