WooCommerce Cart Abandonment Recovery - Version 1.1.8

Version Description

Download this release

Release Info

Developer sandesh055
Plugin Icon 128x128 WooCommerce Cart Abandonment Recovery
Version 1.1.8
Comparing to
See all releases

Code changes from version 1.1.7 to 1.1.8

admin/assets/css/admin-cart-abandonment.css CHANGED
@@ -395,4 +395,8 @@
395
 
396
  .wcf-ca-tag:hover::after {
397
  border-left-color: #f16334;
 
 
 
 
398
  }
395
 
396
  .wcf-ca-tag:hover::after {
397
  border-left-color: #f16334;
398
+ }
399
+
400
+ .wcf-sub-heading {
401
+ font-weight: 400;
402
  }
admin/assets/js/admin-email-templates.js CHANGED
@@ -90,25 +90,13 @@
90
 
91
  $(document).on('click', '#wcf_preview_email', EmailTemplatesAdmin.send_test_email);
92
  $(document).on('click', '.wcf-ca-switch.wcf-toggle-template-status', EmailTemplatesAdmin.toggle_activate_template);
93
-
94
- $("#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date").closest('tr').hide();
95
- if ( $("#wcf_override_global_coupon").is(":checked")) {
96
- $("#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date").closest('tr').show();
97
- }
98
-
99
- $(document).on('click', '#wcf_override_global_coupon', EmailTemplatesAdmin.toggle_coupon_fileds);
100
 
 
 
 
 
 
101
  },
102
-
103
- toggle_coupon_fileds: function() {
104
-
105
- if ( $("#wcf_override_global_coupon").is(":checked")) {
106
- $("#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date").closest('tr').fadeIn();
107
- } else {
108
- $("#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date").closest('tr').fadeOut();
109
- }
110
-
111
- },
112
 
113
  send_test_email: function () {
114
 
90
 
91
  $(document).on('click', '#wcf_preview_email', EmailTemplatesAdmin.send_test_email);
92
  $(document).on('click', '.wcf-ca-switch.wcf-toggle-template-status', EmailTemplatesAdmin.toggle_activate_template);
 
 
 
 
 
 
 
93
 
94
+ var coupon_child_fields = "#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date, #wcf_free_shipping_coupon, #wcf_auto_coupon_apply, #wcf_individual_use_only";
95
+ $(coupon_child_fields).closest('tr').toggle($("#wcf_override_global_coupon").is(":checked"));
96
+ $(document).on('click', '#wcf_override_global_coupon', function () {
97
+ $(coupon_child_fields).closest('tr').fadeToggle($("#wcf_override_global_coupon").is(":checked"));
98
+ });
99
  },
 
 
 
 
 
 
 
 
 
 
100
 
101
  send_test_email: function () {
102
 
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  Version 1.1.7 - Monday, 12th August 2019
2
  - New: Filter added to show the cart total inside the email template.
3
  - New: Filter added to change the cart abandoned time.
1
+ Version 1.1.8 - Tuesday, 3rd September 2019
2
+ - New: Option added to auto-apply coupon on the checkout.
3
+ - New: Option added to apply coupon individually.
4
+ - New: Option added to create free shipping coupons.
5
+
6
  Version 1.1.7 - Monday, 12th August 2019
7
  - New: Filter added to show the cart total inside the email template.
8
  - New: Filter added to change the cart abandoned time.
classes/class-cartflows-ca-loader.php CHANGED
@@ -77,7 +77,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
77
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
78
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
79
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
80
- define( 'CARTFLOWS_CA_VER', '1.1.7' );
81
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
82
 
83
  define( 'CARTFLOWS_CA_CART_ABANDONMENT_TABLE', 'cartflows_ca_cart_abandonment' );
77
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
78
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
79
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
80
+ define( 'CARTFLOWS_CA_VER', '1.1.8' );
81
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
82
 
83
  define( 'CARTFLOWS_CA_CART_ABANDONMENT_TABLE', 'cartflows_ca_cart_abandonment' );
languages/woo-cart-abandonment-recovery.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.1.7\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
8
- "POT-Creation-Date: 2019-08-12 08:43:46+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -100,12 +100,12 @@ msgid ""
100
  msgstr ""
101
 
102
  #: classes/class-cartflows-ca-settings.php:172
103
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:490
104
  msgid "Discount Type"
105
  msgstr ""
106
 
107
  #: classes/class-cartflows-ca-settings.php:181
108
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:522
109
  msgid "Coupon Amount"
110
  msgstr ""
111
 
@@ -160,13 +160,13 @@ msgid "Delete"
160
  msgstr ""
161
 
162
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:70
163
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1488
164
  msgid "Unsubscribe"
165
  msgstr ""
166
 
167
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:184
168
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1618
169
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1673
170
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:168
171
  msgid "Name"
172
  msgstr ""
@@ -176,7 +176,7 @@ msgid "Email"
176
  msgstr ""
177
 
178
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:186
179
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1695
180
  msgid "Cart Total"
181
  msgstr ""
182
 
@@ -189,7 +189,7 @@ msgid "Time"
189
  msgstr ""
190
 
191
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:119
192
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:817
193
  msgid "This order was abandoned & subsequently recovered."
194
  msgstr ""
195
 
@@ -205,85 +205,85 @@ msgstr ""
205
  msgid "Every Fifteen Minutes"
206
  msgstr ""
207
 
208
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:244
209
  msgid "You have successfully unsubscribed from our email list."
210
  msgstr ""
211
 
212
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:244
213
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:159
214
  msgid "Unsubscribed"
215
  msgstr ""
216
 
217
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:401
218
  msgid "No Thanks"
219
  msgstr ""
220
 
221
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:402
222
  msgid "You won't receive further emails from us, thank you!"
223
  msgstr ""
224
 
225
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:929
226
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:930
227
  msgid "Cart Abandonment"
228
  msgstr ""
229
 
230
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:963
231
  msgid "Items deleted: %d"
232
  msgstr ""
233
 
234
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:980
235
  msgid "User unsubscribed successfully!"
236
  msgstr ""
237
 
238
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1175
239
  msgid "Report"
240
  msgstr ""
241
 
242
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1191
243
  msgid "Follow-Up Emails"
244
  msgstr ""
245
 
246
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1207
247
  msgid "Settings"
248
  msgstr ""
249
 
250
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1458
251
  msgid "there"
252
  msgstr ""
253
 
254
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1610
255
  msgid "Cart Total ( Cart Total + Shipping + Tax )"
256
  msgstr ""
257
 
258
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1617
259
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1672
260
  msgid "Item"
261
  msgstr ""
262
 
263
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1619
264
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1674
265
  msgid "Quantity"
266
  msgstr ""
267
 
268
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1620
269
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1675
270
  msgid "Price"
271
  msgstr ""
272
 
273
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1621
274
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1676
275
  msgid "Line Subtotal"
276
  msgstr ""
277
 
278
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1682
279
  msgid "Discount"
280
  msgstr ""
281
 
282
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1686
283
  msgid "Other"
284
  msgstr ""
285
 
286
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1691
287
  msgid "Shipping"
288
  msgstr ""
289
 
@@ -331,47 +331,84 @@ msgstr ""
331
  msgid "Default Email Templates has been restored successfully."
332
  msgstr ""
333
 
334
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:391
335
  msgid "Activate Template now?"
336
  msgstr ""
337
 
338
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:411
339
  msgid "Template Name:"
340
  msgstr ""
341
 
342
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:426
343
  msgid "Email Subject:"
344
  msgstr ""
345
 
346
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:441
347
  msgid "Email Body:"
348
  msgstr ""
349
 
350
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:470
351
  msgid "Create Coupon"
352
  msgstr ""
353
 
354
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:540
 
 
 
 
355
  msgid "Coupon expiry date"
356
  msgstr ""
357
 
 
 
 
 
358
  #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  msgid "Send This Email"
360
  msgstr ""
361
 
362
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:610
363
  msgid "after cart is abandoned."
364
  msgstr ""
365
 
366
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:620
367
  msgid "Send Test Email To:"
368
  msgstr ""
369
 
370
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:934
371
  msgid "Create New Template"
372
  msgstr ""
373
 
374
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:937
375
  msgid " Restore Default Templates"
376
  msgstr ""
377
 
@@ -453,11 +490,11 @@ msgstr ""
453
  msgid "Country:"
454
  msgstr ""
455
 
456
- #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:221
457
  msgid "Checkout Link"
458
  msgstr ""
459
 
460
- #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:236
461
  msgid "User Order Details:"
462
  msgstr ""
463
 
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.1.8\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
8
+ "POT-Creation-Date: 2019-09-03 07:19:54+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
100
  msgstr ""
101
 
102
  #: classes/class-cartflows-ca-settings.php:172
103
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:491
104
  msgid "Discount Type"
105
  msgstr ""
106
 
107
  #: classes/class-cartflows-ca-settings.php:181
108
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:523
109
  msgid "Coupon Amount"
110
  msgstr ""
111
 
160
  msgstr ""
161
 
162
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:70
163
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1502
164
  msgid "Unsubscribe"
165
  msgstr ""
166
 
167
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:184
168
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1632
169
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1687
170
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:168
171
  msgid "Name"
172
  msgstr ""
176
  msgstr ""
177
 
178
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:186
179
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1709
180
  msgid "Cart Total"
181
  msgstr ""
182
 
189
  msgstr ""
190
 
191
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:119
192
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:825
193
  msgid "This order was abandoned & subsequently recovered."
194
  msgstr ""
195
 
205
  msgid "Every Fifteen Minutes"
206
  msgstr ""
207
 
208
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:242
209
  msgid "You have successfully unsubscribed from our email list."
210
  msgstr ""
211
 
212
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:242
213
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:159
214
  msgid "Unsubscribed"
215
  msgstr ""
216
 
217
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:402
218
  msgid "No Thanks"
219
  msgstr ""
220
 
221
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:403
222
  msgid "You won't receive further emails from us, thank you!"
223
  msgstr ""
224
 
225
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:937
226
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:938
227
  msgid "Cart Abandonment"
228
  msgstr ""
229
 
230
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:971
231
  msgid "Items deleted: %d"
232
  msgstr ""
233
 
234
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:988
235
  msgid "User unsubscribed successfully!"
236
  msgstr ""
237
 
238
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1183
239
  msgid "Report"
240
  msgstr ""
241
 
242
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1199
243
  msgid "Follow-Up Emails"
244
  msgstr ""
245
 
246
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1215
247
  msgid "Settings"
248
  msgstr ""
249
 
250
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1464
251
  msgid "there"
252
  msgstr ""
253
 
254
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1624
255
  msgid "Cart Total ( Cart Total + Shipping + Tax )"
256
  msgstr ""
257
 
258
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1631
259
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1686
260
  msgid "Item"
261
  msgstr ""
262
 
263
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1633
264
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1688
265
  msgid "Quantity"
266
  msgstr ""
267
 
268
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1634
269
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1689
270
  msgid "Price"
271
  msgstr ""
272
 
273
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1635
274
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1690
275
  msgid "Line Subtotal"
276
  msgstr ""
277
 
278
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1696
279
  msgid "Discount"
280
  msgstr ""
281
 
282
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1700
283
  msgid "Other"
284
  msgstr ""
285
 
286
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1705
287
  msgid "Shipping"
288
  msgstr ""
289
 
331
  msgid "Default Email Templates has been restored successfully."
332
  msgstr ""
333
 
334
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:392
335
  msgid "Activate Template now?"
336
  msgstr ""
337
 
338
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:412
339
  msgid "Template Name:"
340
  msgstr ""
341
 
342
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:427
343
  msgid "Email Subject:"
344
  msgstr ""
345
 
346
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:442
347
  msgid "Email Body:"
348
  msgstr ""
349
 
350
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:471
351
  msgid "Create Coupon"
352
  msgstr ""
353
 
354
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:484
355
+ msgid "Allows you to send new coupon only for this template."
356
+ msgstr ""
357
+
358
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:541
359
  msgid "Coupon expiry date"
360
  msgstr ""
361
 
362
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:571
363
+ msgid "Enter zero (0) to restrict coupon from expiring"
364
+ msgstr ""
365
+
366
  #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:577
367
+ msgid "Free Shipping"
368
+ msgstr ""
369
+
370
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:590
371
+ msgid ""
372
+ "Allows you to grant free shipping. A free shipping method must be enabled "
373
+ "in your shipping zone and be set to require \"a valid free shipping "
374
+ "coupon\". "
375
+ msgstr ""
376
+
377
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:597
378
+ msgid "Individual use only"
379
+ msgstr ""
380
+
381
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:611
382
+ msgid ""
383
+ "Check this box if the coupon cannot be used in conjunction with other "
384
+ "coupons."
385
+ msgstr ""
386
+
387
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:618
388
+ msgid "Auto Apply Coupon"
389
+ msgstr ""
390
+
391
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:632
392
+ msgid " Automatically add the coupon to the cart at the checkout."
393
+ msgstr ""
394
+
395
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:638
396
  msgid "Send This Email"
397
  msgstr ""
398
 
399
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:671
400
  msgid "after cart is abandoned."
401
  msgstr ""
402
 
403
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:681
404
  msgid "Send Test Email To:"
405
  msgstr ""
406
 
407
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1006
408
  msgid "Create New Template"
409
  msgstr ""
410
 
411
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1009
412
  msgid " Restore Default Templates"
413
  msgstr ""
414
 
490
  msgid "Country:"
491
  msgstr ""
492
 
493
+ #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:224
494
  msgid "Checkout Link"
495
  msgstr ""
496
 
497
+ #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:239
498
  msgid "User Order Details:"
499
  msgstr ""
500
 
modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php CHANGED
@@ -187,13 +187,13 @@ class Cartflows_Ca_Cart_Abandonment {
187
  * @param string $discount_type discount type.
188
  * @param float $amount amount.
189
  * @param string $expiry expiry.
 
 
190
  */
191
- function generate_coupon_code( $discount_type, $amount, $expiry = '' ) {
192
 
193
  $coupon_code = '';
194
 
195
- if ( $discount_type && $amount ) {
196
-
197
  $coupon_code = wp_generate_password( 8, false, false );
198
 
199
  $coupon = array(
@@ -209,17 +209,15 @@ class Cartflows_Ca_Cart_Abandonment {
209
  update_post_meta( $new_coupon_id, 'discount_type', $discount_type );
210
  update_post_meta( $new_coupon_id, 'description', 'This coupon is for abandoned cart email templates.' );
211
  update_post_meta( $new_coupon_id, 'coupon_amount', $amount );
212
- update_post_meta( $new_coupon_id, 'individual_use', 'no' );
213
  update_post_meta( $new_coupon_id, 'product_ids', '' );
214
  update_post_meta( $new_coupon_id, 'exclude_product_ids', '' );
215
  update_post_meta( $new_coupon_id, 'usage_limit', '1' );
216
  update_post_meta( $new_coupon_id, 'date_expires', $expiry );
217
  update_post_meta( $new_coupon_id, 'apply_before_tax', 'yes' );
218
- update_post_meta( $new_coupon_id, 'free_shipping', 'no' );
219
-
220
- }
221
 
222
- return $coupon_code;
223
  }
224
 
225
  /**
@@ -313,8 +311,7 @@ class Cartflows_Ca_Cart_Abandonment {
313
 
314
  // Check if `wcf_restore_token` exists to restore cart data.
315
  $token_data = $this->wcf_decode_token( $wcf_ac_token );
316
-
317
- if ( is_array( $token_data ) && array_key_exists( 'wcf_session_id', $token_data ) ) {
318
  $result = $this->get_checkout_details( $token_data['wcf_session_id'] );
319
  if ( isset( $result ) && WCF_CART_ABANDONED_ORDER === $result->order_status || WCF_CART_LOST_ORDER === $result->order_status ) {
320
  WC()->session->set( 'wcf_session_id', $token_data['wcf_session_id'] );
@@ -348,6 +345,10 @@ class Cartflows_Ca_Cart_Abandonment {
348
 
349
  $woocommerce->cart->add_to_cart( $id, $qty, $cart_item['variation_id'], array(), $cart_item_data );
350
  }
 
 
 
 
351
  }
352
  $other_fields = unserialize( $result->other_fields );
353
 
@@ -453,14 +454,20 @@ class Cartflows_Ca_Cart_Abandonment {
453
  $wcf_ca_coupon_code_status = get_option( 'wcf_ca_coupon_code_status' );
454
 
455
  if ( 'on' === $wcf_ca_coupon_code_status ) {
456
- $discount_type = get_option( 'wcf_ca_discount_type' );
457
- $discount_type = $discount_type ? $discount_type : 'percent';
458
- $amount = get_option( 'wcf_ca_coupon_amount' );
459
- $amount = $amount ? $amount : WCF_DEFAULT_COUPON_AMOUNT;
460
- $coupon_expiry_date = get_option( 'wcf_ca_coupon_expiry' );
461
- $coupon_expiry_unit = get_option( 'wcf_ca_coupon_expiry_unit' );
462
- $coupon_expiry_date = $coupon_expiry_date ? strtotime( $wp_current_datetime . ' +' . $coupon_expiry_date . ' ' . $coupon_expiry_unit ) : '';
463
- $coupon_code = $this->generate_coupon_code( $discount_type, $amount, $coupon_expiry_date );
 
 
 
 
 
 
464
  }
465
 
466
  $wpdb->update(
@@ -518,7 +525,8 @@ class Cartflows_Ca_Cart_Abandonment {
518
  $trigger_details['shipping_address'] = $other_details['wcf_shipping_company'] . ' ' . $other_details['wcf_shipping_address_1'] . ', ' . $other_details['wcf_shipping_city'] . ', ' . $other_details['wcf_shipping_state'] . ', ' . $other_details['wcf_shipping_postcode'];
519
  $trigger_details['shipping_address'] = trim( $trigger_details['shipping_address'], ', ' );
520
  $trigger_details['email'] = $checkout_details->email;
521
- $trigger_details['checkout_url'] = $this->get_checkout_url( $checkout_details->checkout_id, $checkout_details->session_id );
 
522
  $trigger_details['product_names'] = $this->get_comma_separated_products( $checkout_details->cart_contents );
523
  $trigger_details['coupon_code'] = $checkout_details->coupon_code;
524
  $trigger_details['order_status'] = $order_status;
@@ -1092,12 +1100,12 @@ class Cartflows_Ca_Cart_Abandonment {
1092
  * Get checkout url.
1093
  *
1094
  * @param integer $post_id post id.
1095
- * @param string $session_id session id.
1096
  * @return string
1097
  */
1098
- function get_checkout_url( $post_id, $session_id ) {
1099
 
1100
- $token = $this->wcf_generate_token( array( 'wcf_session_id' => $session_id ) );
1101
  $checkout_url = get_permalink( $post_id ) . '?wcf_ac_token=' . $token;
1102
  return esc_url( $checkout_url );
1103
  }
@@ -1446,8 +1454,6 @@ class Cartflows_Ca_Cart_Abandonment {
1446
 
1447
  if ( filter_var( $email_data->email, FILTER_VALIDATE_EMAIL ) ) {
1448
 
1449
- $checkout_url = $this->get_checkout_url( $email_data->checkout_id, $email_data->session_id );
1450
-
1451
  $other_fields = unserialize( $email_data->other_fields );
1452
 
1453
  $from_email_name = get_option( 'wcf_ca_from_name' );
@@ -1467,11 +1473,10 @@ class Cartflows_Ca_Cart_Abandonment {
1467
  $body_email_preview = str_replace( '{{customer.lastname}}', $user_last_name, $body_email_preview );
1468
  $body_email_preview = str_replace( '{{customer.fullname}}', $user_full_name, $body_email_preview );
1469
 
 
1470
  if ( $preview_email ) {
1471
- $coupon_code = 'DUMMY-COUPON';
1472
- $checkout_url = esc_url( $checkout_url . base64_encode( 'dummy-token-string' ) );
1473
  } else {
1474
- $email_instance = Cartflows_Ca_Email_Templates::get_instance();
1475
  $override_global_coupon = $email_instance->get_email_template_meta_by_key( $email_data->email_template_id, 'override_global_coupon' );
1476
  if ( $override_global_coupon->meta_value ) {
1477
  $email_history = $email_instance->get_email_history_by_id( $email_data->email_history_id );
@@ -1481,6 +1486,15 @@ class Cartflows_Ca_Cart_Abandonment {
1481
  }
1482
  }
1483
 
 
 
 
 
 
 
 
 
 
1484
  $body_email_preview = str_replace( '{{cart.coupon_code}}', $coupon_code, $body_email_preview );
1485
 
1486
  $current_time_stamp = $email_data->time;
@@ -1803,11 +1817,17 @@ class Cartflows_Ca_Cart_Abandonment {
1803
 
1804
  $coupon_expiry_date = $coupon_expiry_date ? strtotime( $scheduled_time . ' +' . $coupon_expiry_date . ' ' . $coupon_expiry_unit ) : '';
1805
 
 
 
 
 
 
 
1806
  $override_global_coupon = $email_tmpl->get_email_template_meta_by_key( $template->id, 'override_global_coupon' );
1807
 
1808
  $new_coupon_code = '';
1809
  if ( $override_global_coupon->meta_value ) {
1810
- $new_coupon_code = $this->generate_coupon_code( $discount_type, $amount, $coupon_expiry_date );
1811
  }
1812
 
1813
  $wpdb->replace(
187
  * @param string $discount_type discount type.
188
  * @param float $amount amount.
189
  * @param string $expiry expiry.
190
+ * @param string $free_shipping is free shipping.
191
+ * @param string $individual_use use coupon individual.
192
  */
193
+ function generate_coupon_code( $discount_type, $amount, $expiry = '', $free_shipping = 'no', $individual_use = 'no' ) {
194
 
195
  $coupon_code = '';
196
 
 
 
197
  $coupon_code = wp_generate_password( 8, false, false );
198
 
199
  $coupon = array(
209
  update_post_meta( $new_coupon_id, 'discount_type', $discount_type );
210
  update_post_meta( $new_coupon_id, 'description', 'This coupon is for abandoned cart email templates.' );
211
  update_post_meta( $new_coupon_id, 'coupon_amount', $amount );
212
+ update_post_meta( $new_coupon_id, 'individual_use', $individual_use );
213
  update_post_meta( $new_coupon_id, 'product_ids', '' );
214
  update_post_meta( $new_coupon_id, 'exclude_product_ids', '' );
215
  update_post_meta( $new_coupon_id, 'usage_limit', '1' );
216
  update_post_meta( $new_coupon_id, 'date_expires', $expiry );
217
  update_post_meta( $new_coupon_id, 'apply_before_tax', 'yes' );
218
+ update_post_meta( $new_coupon_id, 'free_shipping', $free_shipping );
 
 
219
 
220
+ return $coupon_code;
221
  }
222
 
223
  /**
311
 
312
  // Check if `wcf_restore_token` exists to restore cart data.
313
  $token_data = $this->wcf_decode_token( $wcf_ac_token );
314
+ if ( is_array( $token_data ) && isset( $token_data['wcf_session_id'] ) ) {
 
315
  $result = $this->get_checkout_details( $token_data['wcf_session_id'] );
316
  if ( isset( $result ) && WCF_CART_ABANDONED_ORDER === $result->order_status || WCF_CART_LOST_ORDER === $result->order_status ) {
317
  WC()->session->set( 'wcf_session_id', $token_data['wcf_session_id'] );
345
 
346
  $woocommerce->cart->add_to_cart( $id, $qty, $cart_item['variation_id'], array(), $cart_item_data );
347
  }
348
+
349
+ if ( isset( $token_data['wcf_coupon_code'] ) && ! $woocommerce->cart->applied_coupons ) {
350
+ $woocommerce->cart->add_discount( $token_data['wcf_coupon_code'] );
351
+ }
352
  }
353
  $other_fields = unserialize( $result->other_fields );
354
 
454
  $wcf_ca_coupon_code_status = get_option( 'wcf_ca_coupon_code_status' );
455
 
456
  if ( 'on' === $wcf_ca_coupon_code_status ) {
457
+ $discount_type = get_option( 'wcf_ca_discount_type' );
458
+ $discount_type = $discount_type ? $discount_type : 'percent';
459
+ $amount = get_option( 'wcf_ca_coupon_amount' );
460
+ $amount = $amount ? $amount : WCF_DEFAULT_COUPON_AMOUNT;
461
+ $coupon_expiry_date = get_option( 'wcf_ca_coupon_expiry' );
462
+ $coupon_expiry_unit = get_option( 'wcf_ca_coupon_expiry_unit' );
463
+ $coupon_expiry_date = $coupon_expiry_date ? strtotime( $wp_current_datetime . ' +' . $coupon_expiry_date . ' ' . $coupon_expiry_unit ) : '';
464
+ $free_shipping_coupon = get_option( 'wcf_ca_free_shipping_coupon' );
465
+ $free_shipping = ( isset( $free_shipping_coupon ) && ( $free_shipping_coupon->meta_value ) ) ? 'yes' : 'no';
466
+
467
+ $individual_use_only = get_option( 'wcf_ca_individual_use_only' );
468
+ $individual_use = ( isset( $individual_use_only ) && ( $individual_use_only->meta_value ) ) ? 'yes' : 'no';
469
+
470
+ $coupon_code = $this->generate_coupon_code( $discount_type, $amount, $coupon_expiry_date, $free_shipping, $individual_use );
471
  }
472
 
473
  $wpdb->update(
525
  $trigger_details['shipping_address'] = $other_details['wcf_shipping_company'] . ' ' . $other_details['wcf_shipping_address_1'] . ', ' . $other_details['wcf_shipping_city'] . ', ' . $other_details['wcf_shipping_state'] . ', ' . $other_details['wcf_shipping_postcode'];
526
  $trigger_details['shipping_address'] = trim( $trigger_details['shipping_address'], ', ' );
527
  $trigger_details['email'] = $checkout_details->email;
528
+ $token_data = array( 'wcf_session_id' => $checkout_details->session_id );
529
+ $trigger_details['checkout_url'] = $this->get_checkout_url( $checkout_details->checkout_id, $token_data );
530
  $trigger_details['product_names'] = $this->get_comma_separated_products( $checkout_details->cart_contents );
531
  $trigger_details['coupon_code'] = $checkout_details->coupon_code;
532
  $trigger_details['order_status'] = $order_status;
1100
  * Get checkout url.
1101
  *
1102
  * @param integer $post_id post id.
1103
+ * @param string $token_data token data.
1104
  * @return string
1105
  */
1106
+ function get_checkout_url( $post_id, $token_data ) {
1107
 
1108
+ $token = $this->wcf_generate_token( (array) $token_data );
1109
  $checkout_url = get_permalink( $post_id ) . '?wcf_ac_token=' . $token;
1110
  return esc_url( $checkout_url );
1111
  }
1454
 
1455
  if ( filter_var( $email_data->email, FILTER_VALIDATE_EMAIL ) ) {
1456
 
 
 
1457
  $other_fields = unserialize( $email_data->other_fields );
1458
 
1459
  $from_email_name = get_option( 'wcf_ca_from_name' );
1473
  $body_email_preview = str_replace( '{{customer.lastname}}', $user_last_name, $body_email_preview );
1474
  $body_email_preview = str_replace( '{{customer.fullname}}', $user_full_name, $body_email_preview );
1475
 
1476
+ $email_instance = Cartflows_Ca_Email_Templates::get_instance();
1477
  if ( $preview_email ) {
1478
+ $coupon_code = 'DUMMY-COUPON';
 
1479
  } else {
 
1480
  $override_global_coupon = $email_instance->get_email_template_meta_by_key( $email_data->email_template_id, 'override_global_coupon' );
1481
  if ( $override_global_coupon->meta_value ) {
1482
  $email_history = $email_instance->get_email_history_by_id( $email_data->email_history_id );
1486
  }
1487
  }
1488
 
1489
+ $auto_apply_coupon = $email_instance->get_email_template_meta_by_key( $email_data->email_template_id, 'auto_coupon' );
1490
+
1491
+ $token_data = array(
1492
+ 'wcf_session_id' => $email_data->session_id,
1493
+ 'wcf_coupon_code' => $auto_apply_coupon->meta_value ? $coupon_code : null,
1494
+ );
1495
+
1496
+ $checkout_url = $this->get_checkout_url( $email_data->checkout_id, $token_data );
1497
+
1498
  $body_email_preview = str_replace( '{{cart.coupon_code}}', $coupon_code, $body_email_preview );
1499
 
1500
  $current_time_stamp = $email_data->time;
1817
 
1818
  $coupon_expiry_date = $coupon_expiry_date ? strtotime( $scheduled_time . ' +' . $coupon_expiry_date . ' ' . $coupon_expiry_unit ) : '';
1819
 
1820
+ $free_shipping_coupon = $email_tmpl->get_email_template_meta_by_key( $template->id, 'free_shipping_coupon' );
1821
+ $free_shipping = ( isset( $free_shipping_coupon ) && ( $free_shipping_coupon->meta_value ) ) ? 'yes' : 'no';
1822
+
1823
+ $individual_use_only = $email_tmpl->get_email_template_meta_by_key( $template->id, 'individual_use_only' );
1824
+ $individual_use = ( isset( $individual_use_only ) && ( $individual_use_only->meta_value ) ) ? 'yes' : 'no';
1825
+
1826
  $override_global_coupon = $email_tmpl->get_email_template_meta_by_key( $template->id, 'override_global_coupon' );
1827
 
1828
  $new_coupon_code = '';
1829
  if ( $override_global_coupon->meta_value ) {
1830
+ $new_coupon_code = $this->generate_coupon_code( $discount_type, $amount, $coupon_expiry_date, $free_shipping, $individual_use );
1831
  }
1832
 
1833
  $wpdb->replace(
modules/cart-abandonment/class-cartflows-ca-email-templates.php CHANGED
@@ -305,6 +305,7 @@ class Cartflows_Ca_Email_Templates {
305
  'coupon_amount' => 10,
306
  'coupon_expiry_date' => '',
307
  'coupon_expiry_unit' => 'hours',
 
308
  );
309
 
310
  foreach ( $meta_data as $mera_key => $meta_value ) {
@@ -480,14 +481,14 @@ class Cartflows_Ca_Email_Templates {
480
  }
481
  }
482
 
483
- print'<input ' . $wcf_override_global_coupon . ' id="wcf_override_global_coupon" name="wcf_override_global_coupon" type="checkbox" value="" /><label for="wcf_override_global_coupon"> Allows you to send new coupon only for this template. </label>';
484
  ?>
485
  </td>
486
  </tr>
487
 
488
  <tr>
489
  <th>
490
- <label for="wcf_email_discount_type"><b><?php _e( 'Discount Type', 'woo-cart-abandonment-recovery' ); ?></b></label>
491
  </th>
492
  <td>
493
  <?php
@@ -519,7 +520,7 @@ class Cartflows_Ca_Email_Templates {
519
 
520
  <tr>
521
  <th>
522
- <label for="wcf_email_discount_amount"><b><?php _e( 'Coupon Amount', 'woo-cart-abandonment-recovery' ); ?></b></label>
523
  </th>
524
  <td>
525
  <?php
@@ -537,7 +538,7 @@ class Cartflows_Ca_Email_Templates {
537
 
538
  <tr>
539
  <th>
540
- <label for="wcf_email_coupon_expiry_date"><b><?php _e( 'Coupon expiry date', 'woo-cart-abandonment-recovery' ); ?></b></label>
541
  </th>
542
  <td>
543
  <?php
@@ -567,11 +568,71 @@ class Cartflows_Ca_Email_Templates {
567
  }
568
  echo '</select>';
569
 
570
- echo " <span class='description'> Enter zero (0) to restrict coupon from expiring </span>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  ?>
572
  </td>
573
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
 
 
 
 
 
575
  <tr>
576
  <th>
577
  <label for="wcf_email_subject"><b><?php _e( 'Send This Email', 'woo-cart-abandonment-recovery' ); ?></b></label>
@@ -714,6 +775,9 @@ class Cartflows_Ca_Email_Templates {
714
  }
715
 
716
  $sanitized_post['wcf_override_global_coupon'] = isset( $_POST['wcf_override_global_coupon'] ) ? true : false;
 
 
 
717
  $sanitized_post['wcf_email_body'] = html_entity_decode( $sanitized_post['wcf_email_body'] );
718
 
719
  return $sanitized_post;
@@ -747,6 +811,10 @@ class Cartflows_Ca_Email_Templates {
747
  'coupon_amount' => $sanitized_post['wcf_email_discount_amount'],
748
  'coupon_expiry_date' => $sanitized_post['wcf_email_coupon_expiry_date'],
749
  'coupon_expiry_unit' => $sanitized_post['wcf_coupon_expiry_unit'],
 
 
 
 
750
  );
751
 
752
  foreach ( $meta_data as $mera_key => $meta_value ) {
@@ -793,6 +861,10 @@ class Cartflows_Ca_Email_Templates {
793
  'coupon_amount' => $sanitized_post['wcf_email_discount_amount'],
794
  'coupon_expiry_date' => $sanitized_post['wcf_email_coupon_expiry_date'],
795
  'coupon_expiry_unit' => $sanitized_post['wcf_coupon_expiry_unit'],
 
 
 
 
796
  );
797
  foreach ( $meta_data as $mera_key => $meta_value ) {
798
  $this->update_email_template_meta( $email_template_id, $mera_key, $meta_value );
305
  'coupon_amount' => 10,
306
  'coupon_expiry_date' => '',
307
  'coupon_expiry_unit' => 'hours',
308
+
309
  );
310
 
311
  foreach ( $meta_data as $mera_key => $meta_value ) {
481
  }
482
  }
483
 
484
+ print'<input ' . $wcf_override_global_coupon . ' id="wcf_override_global_coupon" name="wcf_override_global_coupon" type="checkbox" value="" /><span class="description">' . __( 'Allows you to send new coupon only for this template.', 'woo-cart-abandonment-recovery' ) . '</span>';
485
  ?>
486
  </td>
487
  </tr>
488
 
489
  <tr>
490
  <th>
491
+ <label class="wcf-sub-heading" for="wcf_email_discount_type"> <?php _e( 'Discount Type', 'woo-cart-abandonment-recovery' ); ?> </label>
492
  </th>
493
  <td>
494
  <?php
520
 
521
  <tr>
522
  <th>
523
+ <label class="wcf-sub-heading" for="wcf_email_discount_amount"> <?php _e( 'Coupon Amount', 'woo-cart-abandonment-recovery' ); ?> </label>
524
  </th>
525
  <td>
526
  <?php
538
 
539
  <tr>
540
  <th>
541
+ <label class="wcf-sub-heading" for="wcf_email_coupon_expiry_date"> <?php _e( 'Coupon expiry date', 'woo-cart-abandonment-recovery' ); ?> </label>
542
  </th>
543
  <td>
544
  <?php
568
  }
569
  echo '</select>';
570
 
571
+ echo " <span class='description'>" . __( 'Enter zero (0) to restrict coupon from expiring', 'woo-cart-abandonment-recovery' ) . ' </span>'
572
+ ?>
573
+ </td>
574
+ </tr>
575
+ <tr>
576
+ <th>
577
+ <label class="wcf-sub-heading" for="wcf_free_shipping_coupon"> <?php _e( 'Free Shipping', 'woo-cart-abandonment-recovery' ); ?> </label>
578
+ </th>
579
+ <td>
580
+ <?php
581
+
582
+ $wcf_free_shipping_coupon = '';
583
+ if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results ) {
584
+ $wcf_free_shipping_coupon = $this->get_email_template_meta_by_key( $results->id, 'free_shipping_coupon' );
585
+ if ( isset( $wcf_free_shipping_coupon->meta_value ) ) {
586
+ $wcf_free_shipping_coupon = $wcf_free_shipping_coupon->meta_value ? 'checked' : '';
587
+ }
588
+ }
589
+
590
+ print'<input ' . $wcf_free_shipping_coupon . ' id="wcf_free_shipping_coupon" name="wcf_free_shipping_coupon" type="checkbox" value="" /><span class="description"> ' . __( 'Allows you to grant free shipping. A free shipping method must be enabled in your shipping zone and be set to require "a valid free shipping coupon". ', 'woo-cart-abandonment-recovery' ) . '</span>';
591
+
592
+ ?>
593
+ </td>
594
+ </tr>
595
+ <tr>
596
+ <th>
597
+ <label class="wcf-sub-heading" for="wcf_individual_use_only"><?php _e( 'Individual use only', 'woo-cart-abandonment-recovery' ); ?></label>
598
+ </th>
599
+ <td>
600
+ <?php
601
+
602
+ $wcf_individual_use_only = '';
603
+ if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results ) {
604
+ $wcf_individual_use_only = $this->get_email_template_meta_by_key( $results->id, 'individual_use_only' );
605
+ if ( isset( $wcf_individual_use_only->meta_value ) ) {
606
+ $wcf_individual_use_only = $wcf_individual_use_only->meta_value ? 'checked' : '';
607
+ }
608
+ }
609
+
610
+ print'<input ' . $wcf_individual_use_only . ' id="wcf_individual_use_only" name="wcf_individual_use_only" type="checkbox" value="" />
611
+ <span class="description">' . __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woo-cart-abandonment-recovery' ) . ' </span>';
612
+
613
  ?>
614
  </td>
615
  </tr>
616
+ <tr>
617
+ <th>
618
+ <label class="wcf-sub-heading" for="wcf_apply_coupon_auto"> <?php _e( 'Auto Apply Coupon', 'woo-cart-abandonment-recovery' ); ?> </label>
619
+ </th>
620
+ <td>
621
+ <?php
622
+
623
+ $wcf_apply_coupon_auto = '';
624
+ if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results ) {
625
+ $wcf_apply_coupon_auto = $this->get_email_template_meta_by_key( $results->id, 'auto_coupon' );
626
+
627
+ if ( isset( $wcf_apply_coupon_auto->meta_value ) ) {
628
+ $wcf_apply_coupon_auto = $wcf_apply_coupon_auto->meta_value ? 'checked' : '';
629
+ }
630
+ }
631
 
632
+ print'<input ' . $wcf_apply_coupon_auto . ' id="wcf_auto_coupon_apply" name="wcf_auto_coupon_apply" type="checkbox" value="" /><span class="description" > ' . __( ' Automatically add the coupon to the cart at the checkout.', 'woo-cart-abandonment-recovery' ) . ' </span>';
633
+ ?>
634
+ </td>
635
+ </tr>
636
  <tr>
637
  <th>
638
  <label for="wcf_email_subject"><b><?php _e( 'Send This Email', 'woo-cart-abandonment-recovery' ); ?></b></label>
775
  }
776
 
777
  $sanitized_post['wcf_override_global_coupon'] = isset( $_POST['wcf_override_global_coupon'] ) ? true : false;
778
+ $sanitized_post['wcf_auto_coupon_apply'] = isset( $_POST['wcf_auto_coupon_apply'] ) ? true : false;
779
+ $sanitized_post['wcf_free_shipping_coupon'] = isset( $_POST['wcf_free_shipping_coupon'] ) ? true : false;
780
+ $sanitized_post['wcf_individual_use_only'] = isset( $_POST['wcf_individual_use_only'] ) ? true : false;
781
  $sanitized_post['wcf_email_body'] = html_entity_decode( $sanitized_post['wcf_email_body'] );
782
 
783
  return $sanitized_post;
811
  'coupon_amount' => $sanitized_post['wcf_email_discount_amount'],
812
  'coupon_expiry_date' => $sanitized_post['wcf_email_coupon_expiry_date'],
813
  'coupon_expiry_unit' => $sanitized_post['wcf_coupon_expiry_unit'],
814
+ 'auto_coupon' => $sanitized_post['wcf_auto_coupon_apply'],
815
+ 'free_shipping_coupon' => $sanitized_post['wcf_free_shipping_coupon'],
816
+ 'individual_use_only' => $sanitized_post['wcf_individual_use_only'],
817
+
818
  );
819
 
820
  foreach ( $meta_data as $mera_key => $meta_value ) {
861
  'coupon_amount' => $sanitized_post['wcf_email_discount_amount'],
862
  'coupon_expiry_date' => $sanitized_post['wcf_email_coupon_expiry_date'],
863
  'coupon_expiry_unit' => $sanitized_post['wcf_coupon_expiry_unit'],
864
+ 'auto_coupon' => $sanitized_post['wcf_auto_coupon_apply'],
865
+ 'free_shipping_coupon' => $sanitized_post['wcf_free_shipping_coupon'],
866
+ 'individual_use_only' => $sanitized_post['wcf_individual_use_only'],
867
+
868
  );
869
  foreach ( $meta_data as $mera_key => $meta_value ) {
870
  $this->update_email_template_meta( $email_template_id, $mera_key, $meta_value );
modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php CHANGED
@@ -216,8 +216,11 @@
216
  <strong> <?php _e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_postcode ); ?>
217
  </p>
218
  <p>
219
- <?php $cart_abandonment = Cartflows_Ca_Cart_Abandonment::get_instance(); ?>
220
- <strong> <a target="_blank" href=" <?php echo $cart_abandonment->get_checkout_url( $details->checkout_id, $details->session_id ); ?> ">
 
 
 
221
  <?php _e( 'Checkout Link', 'woo-cart-abandonment-recovery' ); ?>
222
  </a>
223
  </strong>
216
  <strong> <?php _e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_postcode ); ?>
217
  </p>
218
  <p>
219
+ <?php
220
+ $cart_abandonment = Cartflows_Ca_Cart_Abandonment::get_instance();
221
+ $token_data = array( 'wcf_session_id' => $details->session_id );
222
+ ?>
223
+ <strong> <a target="_blank" href=" <?php echo $cart_abandonment->get_checkout_url( $details->checkout_id, $token_data ); ?> ">
224
  <?php _e( 'Checkout Link', 'woo-cart-abandonment-recovery' ); ?>
225
  </a>
226
  </strong>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: woocommerce, cart abandonment, cart recovery
5
  Requires at least: 4.4
6
  Tested up to: 5.2
7
- Stable tag: 1.1.7
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -128,26 +128,31 @@ Here are few thoughts behind making it available for free:
128
  4. General settings for Email, Webhook (Coupon Code), GDPR
129
 
130
  == Changelog ==
131
- = Version 1.1.7 - Monday, 12th August 2019
 
 
 
 
 
132
  * New: Filter added to show the cart total inside the email template.
133
  * New: Filter added to change the cart abandoned time.
134
  * Improvement: Order tracking logic updated for automated payments.
135
  * Improvement: Update report dashboard DateTime format to WordPress format.
136
  * Fix: Broken image in the email template.
137
 
138
- = Version 1.1.6 - Friday, 19th July 2019
139
  * New: Bundled product support for email checkout URL.
140
  * Improvement: Added phone number and address while triggering the to webhook.
141
  * Fix: Creating tables and default settings on activation.
142
 
143
- = Version 1.1.5 - Tuesday, 9th July 2019
144
  * Fix: Other crons disappearing issue.
145
 
146
- = Version 1.1.4 - Tuesday, 9th July 2019
147
  * Fix: Follow up emails were getting sent even after the completion of the order.
148
  * Fix: Email template variable 'Abandoned Product Names' warning issue.
149
 
150
- = Version 1.1.3 - Thursday, 27th June 2019
151
  * Improvement: Added checkout link for abandoned cart inside the admin section.
152
  * Fix: Added pagination for reports.
153
  * Fix: Recover report calculations before campaign triggers.
4
  Tags: woocommerce, cart abandonment, cart recovery
5
  Requires at least: 4.4
6
  Tested up to: 5.2
7
+ Stable tag: 1.1.8
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
128
  4. General settings for Email, Webhook (Coupon Code), GDPR
129
 
130
  == Changelog ==
131
+ = Version 1.1.8 - Tuesday, 3rd September 2019 =
132
+ * New: Option added to auto-apply coupon on the checkout.
133
+ * New: Option added to apply coupon individually.
134
+ * New: Option added to create free shipping coupons.
135
+
136
+ = Version 1.1.7 - Monday, 12th August 2019 =
137
  * New: Filter added to show the cart total inside the email template.
138
  * New: Filter added to change the cart abandoned time.
139
  * Improvement: Order tracking logic updated for automated payments.
140
  * Improvement: Update report dashboard DateTime format to WordPress format.
141
  * Fix: Broken image in the email template.
142
 
143
+ = Version 1.1.6 - Friday, 19th July 2019 =
144
  * New: Bundled product support for email checkout URL.
145
  * Improvement: Added phone number and address while triggering the to webhook.
146
  * Fix: Creating tables and default settings on activation.
147
 
148
+ = Version 1.1.5 - Tuesday, 9th July 2019 =
149
  * Fix: Other crons disappearing issue.
150
 
151
+ = Version 1.1.4 - Tuesday, 9th July 2019 =
152
  * Fix: Follow up emails were getting sent even after the completion of the order.
153
  * Fix: Email template variable 'Abandoned Product Names' warning issue.
154
 
155
+ = Version 1.1.3 - Thursday, 27th June 2019 =
156
  * Improvement: Added checkout link for abandoned cart inside the admin section.
157
  * Fix: Added pagination for reports.
158
  * Fix: Recover report calculations before campaign triggers.
woo-cart-abandonment-recovery.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
- * Version: 1.1.7
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
+ * Version: 1.1.8
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery