WooCommerce Direct Checkout - Version 2.2.4

Version Description

  • Fix. WooCommerce Direct Checkout quick purchase button on safari
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Direct Checkout
Version 2.2.4
Comparing to
See all releases

Code changes from version 2.2.3 to 2.2.4

assets/frontend/qlwcdc.js CHANGED
@@ -84,60 +84,59 @@
84
  }
85
  });
86
 
87
- $(document).on('submit', 'form.cart', function (e) {
88
-
89
- var $button = $(e.delegateTarget.activeElement);
90
-
91
- if ($button.hasClass('qlwcdc_quick_purchase')) {
92
-
93
- e.preventDefault();
94
-
95
- var $form = $(this),
96
- product_id = $form.find('[name=add-to-cart]').val() || 0,
97
- variation_id = $form.find('[name=variation_id]').val() || 0,
98
- quantity = $form.find('[name=quantity]').val() || 1,
99
- license_key = $form.find('[name=license_key]').val() || 0,
100
- license_email = $form.find('[name=license_email]').val() || 0,
101
- license_renewal = $form.find('[name=license_renewal]').val() || 0,
102
- addons = $form.find('.wc-pao-addon-field').serialize().replace(/\%5B%5D/g, '[]') || 0;
103
-
104
- $button.attr('data-href', function (i, h) {
105
- if (h.indexOf('?') != -1) {
106
- $button.attr('data-href', $button.attr('data-href') + '&add-to-cart=' + product_id);
107
- } else {
108
- $button.attr('data-href', $button.attr('data-href') + '?add-to-cart=' + product_id);
109
- }
110
- });
111
 
112
- if (variation_id) {
113
- $button.attr('data-href', $button.attr('data-href') + '&variation_id=' + variation_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
 
115
 
116
- if (quantity) {
117
- $button.attr('data-href', $button.attr('data-href') + '&quantity=' + quantity);
118
- }
119
 
120
- if (addons) {
121
- $button.attr('data-href', $button.attr('data-href') + '&' + addons);
122
- }
123
 
124
- if (license_key) {
125
- $button.attr('data-href', $button.attr('data-href') + '&license_key=' + license_key);
126
- }
127
 
128
- if (license_email) {
129
- $button.attr('data-href', $button.attr('data-href') + '&license_email=' + license_email);
130
- }
131
 
132
- if (license_renewal) {
133
- $button.attr('data-href', $button.attr('data-href') + '&license_renewal=' + license_renewal);
134
- }
135
 
136
- if ($button.attr('data-href') != 'undefined') {
137
- document.location.href = $button.attr('data-href');
138
- }
 
 
 
139
  }
140
 
 
 
141
  });
142
 
143
  /*$(document).on('click', '.single_add_to_cart_button:not(.qlwcdc_quick_purchase):not(.disabled)', function (e) {
84
  }
85
  });
86
 
87
+ $('form.cart').on('click', '.qlwcdc_quick_purchase', function (e) {
88
+ e.preventDefault();
89
+ e.stopPropagation();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ var $button = $(this),
92
+ $form = $(e.delegateTarget);
93
+
94
+ var product_id = $form.find('[name=add-to-cart]').val() || 0,
95
+ variation_id = $form.find('[name=variation_id]').val() || 0,
96
+ quantity = $form.find('[name=quantity]').val() || 1,
97
+ license_key = $form.find('[name=license_key]').val() || 0,
98
+ license_email = $form.find('[name=license_email]').val() || 0,
99
+ license_renewal = $form.find('[name=license_renewal]').val() || 0,
100
+ addons = $form.find('.wc-pao-addon-field').serialize().replace(/\%5B%5D/g, '[]') || 0;
101
+
102
+ $button.attr('data-href', function (i, h) {
103
+ if (h.indexOf('?') != -1) {
104
+ $button.attr('data-href', $button.attr('data-href') + '&add-to-cart=' + product_id);
105
+ } else {
106
+ $button.attr('data-href', $button.attr('data-href') + '?add-to-cart=' + product_id);
107
  }
108
+ });
109
 
110
+ if (variation_id) {
111
+ $button.attr('data-href', $button.attr('data-href') + '&variation_id=' + variation_id);
112
+ }
113
 
114
+ if (quantity) {
115
+ $button.attr('data-href', $button.attr('data-href') + '&quantity=' + quantity);
116
+ }
117
 
118
+ if (addons) {
119
+ $button.attr('data-href', $button.attr('data-href') + '&' + addons);
120
+ }
121
 
122
+ if (license_key) {
123
+ $button.attr('data-href', $button.attr('data-href') + '&license_key=' + license_key);
124
+ }
125
 
126
+ if (license_email) {
127
+ $button.attr('data-href', $button.attr('data-href') + '&license_email=' + license_email);
128
+ }
129
 
130
+ if (license_renewal) {
131
+ $button.attr('data-href', $button.attr('data-href') + '&license_renewal=' + license_renewal);
132
+ }
133
+
134
+ if ($button.attr('data-href') != 'undefined') {
135
+ document.location.href = $button.attr('data-href');
136
  }
137
 
138
+ return false;
139
+
140
  });
141
 
142
  /*$(document).on('click', '.single_add_to_cart_button:not(.qlwcdc_quick_purchase):not(.disabled)', function (e) {
assets/frontend/qlwcdc.min.js CHANGED
@@ -1,2 +1,2 @@
1
 
2
- (function(d){var c;var b=1000;var e=function(g){return g.is(".processing")||g.parents(".processing").length};var f=function(g){if(!e(g)){g.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(g){g.removeClass("processing").unblock()};d(document).on("click",".qlwcdc_quick_view",function(i){i.stopPropagation();i.preventDefault();var h=d(this).data("product_id"),g=d("#qlwcdc_quick_view_modal");if(h&&woocommerce_params.ajax_url){d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_quick_view_modal",nonce:qlwcdc.nonce,product_id:h},complete:function(j){g.addClass("opening");setTimeout(function(){g.addClass("open");g.removeClass("opening")},50)},success:function(k){var j=d(k);j.find(".woocommerce-product-gallery").each(function(){d(this).wc_product_gallery()});j.on("click",".close",function(l){g.addClass("closing");setTimeout(function(){g.removeClass("open");g.removeClass("closing")},600)});g.find(".modal-content").replaceWith(j);if(typeof wc_add_to_cart_variation_params!=="undefined"){g.find(".variations_form").wc_variation_form()}}})}return false});d("#qlwcdc_quick_view_modal").on("click",function(i){var g=d(i.target),h=d(i.delegateTarget);if(g.hasClass("modal-dialog")){h.addClass("closing");setTimeout(function(){h.removeClass("open");h.removeClass("closing")},600)}});d(document).on("submit","form.cart",function(k){var g=d(k.delegateTarget.activeElement);if(g.hasClass("qlwcdc_quick_purchase")){k.preventDefault();var p=d(this),i=p.find("[name=add-to-cart]").val()||0,j=p.find("[name=variation_id]").val()||0,h=p.find("[name=quantity]").val()||1,l=p.find("[name=license_key]").val()||0,o=p.find("[name=license_email]").val()||0,n=p.find("[name=license_renewal]").val()||0,m=p.find(".wc-pao-addon-field").serialize().replace(/\%5B%5D/g,"[]")||0;g.attr("data-href",function(q,r){if(r.indexOf("?")!=-1){g.attr("data-href",g.attr("data-href")+"&add-to-cart="+i)}else{g.attr("data-href",g.attr("data-href")+"?add-to-cart="+i)}});if(j){g.attr("data-href",g.attr("data-href")+"&variation_id="+j)}if(h){g.attr("data-href",g.attr("data-href")+"&quantity="+h)}if(m){g.attr("data-href",g.attr("data-href")+"&"+m)}if(l){g.attr("data-href",g.attr("data-href")+"&license_key="+l)}if(o){g.attr("data-href",g.attr("data-href")+"&license_email="+o)}if(n){g.attr("data-href",g.attr("data-href")+"&license_renewal="+n)}if(g.attr("data-href")!="undefined"){document.location.href=g.attr("data-href")}}});d(document).on("keyup","#qlwcdc_order_coupon_code",function(j){var h=d(this),i=d(this).find('input[name="coupon_code"]'),g=i.val();if(c){clearTimeout(c)}if(!g){return}c=setTimeout(function(){if(h.is(".processing")){return false}h.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}});var k={security:wc_checkout_params.apply_coupon_nonce,coupon_code:g};d.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:k,success:function(l){h.removeClass("processing").unblock();if(l){i.before(d(l).hide().fadeIn());setTimeout(function(){d(document.body).trigger("update_checkout",{update_shipping_method:false})},b*2)}},dataType:"html"});return false},b)});d("#order_review").on("change","input.qty",function(h){h.preventDefault();var g=d(this);setTimeout(function(){var i=g.attr("name").replace(/cart\[([\w]+)\]\[qty\]/g,"$1"),j=parseFloat(g.val());d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_update_cart",nonce:qlwcdc.nonce,hash:i,quantity:j},beforeSend:function(k){f(d("#order_review"))},complete:function(k){a(d("#order_review"))},success:function(k){if(k){d("#order_review").html(d(k).html()).trigger("updated_checkout")}},})},400)});d("#order_review").on("click","a.remove",function(h){h.preventDefault();var g=d(this).data("cart_item_key");d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_update_cart",nonce:qlwcdc.nonce,quantity:0,hash:g},beforeSend:function(i){f(d("#order_review"))},complete:function(i){a(d("#order_review"))},success:function(i){if(i){d("#order_review").html(d(i).html()).trigger("updated_checkout")}},})})})(jQuery);
1
 
2
+ (function(d){var c;var b=1000;var e=function(g){return g.is(".processing")||g.parents(".processing").length};var f=function(g){if(!e(g)){g.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var a=function(g){g.removeClass("processing").unblock()};d(document).on("click",".qlwcdc_quick_view",function(i){i.stopPropagation();i.preventDefault();var h=d(this).data("product_id"),g=d("#qlwcdc_quick_view_modal");if(h&&woocommerce_params.ajax_url){d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_quick_view_modal",nonce:qlwcdc.nonce,product_id:h},complete:function(j){g.addClass("opening");setTimeout(function(){g.addClass("open");g.removeClass("opening")},50)},success:function(k){var j=d(k);j.find(".woocommerce-product-gallery").each(function(){d(this).wc_product_gallery()});j.on("click",".close",function(l){g.addClass("closing");setTimeout(function(){g.removeClass("open");g.removeClass("closing")},600)});g.find(".modal-content").replaceWith(j);if(typeof wc_add_to_cart_variation_params!=="undefined"){g.find(".variations_form").wc_variation_form()}}})}return false});d("#qlwcdc_quick_view_modal").on("click",function(i){var g=d(i.target),h=d(i.delegateTarget);if(g.hasClass("modal-dialog")){h.addClass("closing");setTimeout(function(){h.removeClass("open");h.removeClass("closing")},600)}});d("form.cart").on("click",".qlwcdc_quick_purchase",function(k){k.preventDefault();k.stopPropagation();var g=d(this),p=d(k.delegateTarget);var i=p.find("[name=add-to-cart]").val()||0,j=p.find("[name=variation_id]").val()||0,h=p.find("[name=quantity]").val()||1,l=p.find("[name=license_key]").val()||0,o=p.find("[name=license_email]").val()||0,n=p.find("[name=license_renewal]").val()||0,m=p.find(".wc-pao-addon-field").serialize().replace(/\%5B%5D/g,"[]")||0;g.attr("data-href",function(q,r){if(r.indexOf("?")!=-1){g.attr("data-href",g.attr("data-href")+"&add-to-cart="+i)}else{g.attr("data-href",g.attr("data-href")+"?add-to-cart="+i)}});if(j){g.attr("data-href",g.attr("data-href")+"&variation_id="+j)}if(h){g.attr("data-href",g.attr("data-href")+"&quantity="+h)}if(m){g.attr("data-href",g.attr("data-href")+"&"+m)}if(l){g.attr("data-href",g.attr("data-href")+"&license_key="+l)}if(o){g.attr("data-href",g.attr("data-href")+"&license_email="+o)}if(n){g.attr("data-href",g.attr("data-href")+"&license_renewal="+n)}if(g.attr("data-href")!="undefined"){document.location.href=g.attr("data-href")}return false});d(document).on("keyup","#qlwcdc_order_coupon_code",function(j){var h=d(this),i=d(this).find('input[name="coupon_code"]'),g=i.val();if(c){clearTimeout(c)}if(!g){return}c=setTimeout(function(){if(h.is(".processing")){return false}h.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}});var k={security:wc_checkout_params.apply_coupon_nonce,coupon_code:g};d.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:k,success:function(l){h.removeClass("processing").unblock();if(l){i.before(d(l).hide().fadeIn());setTimeout(function(){d(document.body).trigger("update_checkout",{update_shipping_method:false})},b*2)}},dataType:"html"});return false},b)});d("#order_review").on("change","input.qty",function(h){h.preventDefault();var g=d(this);setTimeout(function(){var i=g.attr("name").replace(/cart\[([\w]+)\]\[qty\]/g,"$1"),j=parseFloat(g.val());d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_update_cart",nonce:qlwcdc.nonce,hash:i,quantity:j},beforeSend:function(k){f(d("#order_review"))},complete:function(k){a(d("#order_review"))},success:function(k){if(k){d("#order_review").html(d(k).html()).trigger("updated_checkout")}},})},400)});d("#order_review").on("click","a.remove",function(h){h.preventDefault();var g=d(this).data("cart_item_key");d.ajax({type:"post",url:woocommerce_params.ajax_url,data:{action:"qlwcdc_update_cart",nonce:qlwcdc.nonce,quantity:0,hash:g},beforeSend:function(i){f(d("#order_review"))},complete:function(i){a(d("#order_review"))},success:function(i){if(i){d("#order_review").html(d(i).html()).trigger("updated_checkout")}},})})})(jQuery);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/woocommerce-direct-checkout/
4
  Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
5
  Requires at least: 4.8
6
  Tested up to: 5.2.2
7
- Stable tag: 2.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -53,6 +53,9 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 2.2.3 =
57
  * Fix. WooCommerce Direct Checkout quick view for variations
58
 
4
  Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
5
  Requires at least: 4.8
6
  Tested up to: 5.2.2
7
+ Stable tag: 2.2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
53
 
54
  == Changelog ==
55
 
56
+ = 2.2.4 =
57
+ * Fix. WooCommerce Direct Checkout quick purchase button on safari
58
+
59
  = 2.2.3 =
60
  * Fix. WooCommerce Direct Checkout quick view for variations
61
 
woocommerce-direct-checkout.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce Direct Checkout
4
  * Description: Simplifies the checkout process to improve your sales rate.
5
- * Version: 2.2.3
6
  * Author: QuadLayers
7
  * Author URI: https://www.quadlayers.com
8
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
@@ -15,7 +15,7 @@ if (!defined('QLWCDC_PLUGIN_NAME')) {
15
  define('QLWCDC_PLUGIN_NAME', 'WooCommerce Direct Checkout');
16
  }
17
  if (!defined('QLWCDC_PLUGIN_VERSION')) {
18
- define('QLWCDC_PLUGIN_VERSION', '2.2.3');
19
  }
20
  if (!defined('QLWCDC_PLUGIN_FILE')) {
21
  define('QLWCDC_PLUGIN_FILE', __FILE__);
@@ -120,7 +120,7 @@ if (!class_exists('QLWCDC')) {
120
 
121
  public static function is_min() {
122
  if (!defined('SCRIPT_DEBUG') || !SCRIPT_DEBUG) {
123
- return '.min';
124
  }
125
  }
126
 
2
  /**
3
  * Plugin Name: WooCommerce Direct Checkout
4
  * Description: Simplifies the checkout process to improve your sales rate.
5
+ * Version: 2.2.4
6
  * Author: QuadLayers
7
  * Author URI: https://www.quadlayers.com
8
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
15
  define('QLWCDC_PLUGIN_NAME', 'WooCommerce Direct Checkout');
16
  }
17
  if (!defined('QLWCDC_PLUGIN_VERSION')) {
18
+ define('QLWCDC_PLUGIN_VERSION', '2.2.4');
19
  }
20
  if (!defined('QLWCDC_PLUGIN_FILE')) {
21
  define('QLWCDC_PLUGIN_FILE', __FILE__);
120
 
121
  public static function is_min() {
122
  if (!defined('SCRIPT_DEBUG') || !SCRIPT_DEBUG) {
123
+ //return '.min';
124
  }
125
  }
126