Version Description
- Fix. WooCommerce Direct Checkout quick view for variations
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Direct Checkout |
Version | 2.2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 2.2.3
- assets/backend/qlwcdc-admin.js +131 -0
- assets/backend/qlwcdc-admin.min.js +1 -0
- assets/{img → frontend/img}/checkout.png +0 -0
- assets/{img → frontend/img}/logo.jpg +0 -0
- assets/{img → frontend/img}/modal.png +0 -0
- assets/{qlwcdc.css → frontend/qlwcdc.css} +0 -0
- assets/{qlwcdc.js → frontend/qlwcdc.js} +12 -8
- assets/{qlwcdc.min.css → frontend/qlwcdc.min.css} +0 -0
- assets/frontend/qlwcdc.min.js +2 -0
- assets/qlwcdc.min.js +0 -2
- includes/checkout.php +1 -0
- readme.txt +9 -3
- woocommerce-direct-checkout.php +35 -141
assets/backend/qlwcdc-admin.js
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
'use strict';
|
3 |
+
$(window).on('load', function (e) {
|
4 |
+
// General
|
5 |
+
// -----------------------------------------------------------------
|
6 |
+
$('select#qlwcdc_add_to_cart_redirect_page').change(function () {
|
7 |
+
if ('url' === $(this).val() && 'yes' == $('select#qlwcdc_add_to_cart_redirect').val()) {
|
8 |
+
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr, p').fadeIn();
|
9 |
+
} else {
|
10 |
+
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
11 |
+
}
|
12 |
+
});
|
13 |
+
$('select#qlwcdc_add_to_cart_redirect').change(function () {
|
14 |
+
if ('yes' === $(this).val()) {
|
15 |
+
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
16 |
+
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr, p').fadeIn();
|
17 |
+
} else {
|
18 |
+
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
19 |
+
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
20 |
+
}
|
21 |
+
}).change();
|
22 |
+
$('select#qlwcdc_add_to_cart_redirect_page').change(function () {
|
23 |
+
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_to_cart').val()) {
|
24 |
+
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr, p').fadeIn();
|
25 |
+
} else {
|
26 |
+
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
27 |
+
}
|
28 |
+
});
|
29 |
+
$('select#qlwcdc_add_to_cart').change(function () {
|
30 |
+
if ('ajax' === $(this).val()) {
|
31 |
+
$('select#qlwcdc_add_to_cart_ajax_button').closest('tr, p').fadeIn();
|
32 |
+
$('select#qlwcdc_add_to_cart_ajax_message').closest('tr, p').fadeIn();
|
33 |
+
} else {
|
34 |
+
$('select#qlwcdc_add_to_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
35 |
+
$('select#qlwcdc_add_to_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
36 |
+
}
|
37 |
+
if ('redirect' === $(this).val()) {
|
38 |
+
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr, p').fadeIn();
|
39 |
+
} else {
|
40 |
+
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
41 |
+
}
|
42 |
+
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
43 |
+
}).change();
|
44 |
+
// Archive
|
45 |
+
// -----------------------------------------------------------------
|
46 |
+
/*$('select#qlwcdc_add_archive_cart_redirect_page').change(function () {
|
47 |
+
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_archive_cart').val()) {
|
48 |
+
$('input#qlwcdc_add_archive_cart_redirect_url').closest('tr, p').fadeIn();
|
49 |
+
} else {
|
50 |
+
$('input#qlwcdc_add_archive_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
51 |
+
}
|
52 |
+
});
|
53 |
+
$('select#qlwcdc_add_archive_cart').change(function () {
|
54 |
+
if ('ajax' === $(this).val()) {
|
55 |
+
$('select#qlwcdc_add_archive_cart_ajax_button').closest('tr, p').fadeIn();
|
56 |
+
$('select#qlwcdc_add_archive_cart_ajax_message').closest('tr, p').fadeIn();
|
57 |
+
} else {
|
58 |
+
$('select#qlwcdc_add_archive_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
59 |
+
$('select#qlwcdc_add_archive_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
60 |
+
}
|
61 |
+
if ('redirect' === $(this).val()) {
|
62 |
+
$('select#qlwcdc_add_archive_cart_redirect_page').closest('tr, p').fadeIn();
|
63 |
+
} else {
|
64 |
+
$('select#qlwcdc_add_archive_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
65 |
+
}
|
66 |
+
$('select#qlwcdc_add_archive_cart_redirect_page').change();
|
67 |
+
}).change();*/
|
68 |
+
$('select#qlwcdc_add_archive_text').change(function () {
|
69 |
+
if ('yes' === $(this).val()) {
|
70 |
+
$('select#qlwcdc_add_archive_text_in').closest('tr, p').fadeIn();
|
71 |
+
$('input#qlwcdc_add_archive_text_content').closest('tr, p').fadeIn();
|
72 |
+
} else {
|
73 |
+
$('select#qlwcdc_add_archive_text_in').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
74 |
+
$('input#qlwcdc_add_archive_text_content').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
75 |
+
}
|
76 |
+
}).change();
|
77 |
+
// Product
|
78 |
+
// -----------------------------------------------------------------
|
79 |
+
/*$('select#qlwcdc_add_product_cart_redirect_page').change(function () {
|
80 |
+
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_product_cart').val()) {
|
81 |
+
$('input#qlwcdc_add_product_cart_redirect_url').closest('tr, p').fadeIn();
|
82 |
+
} else {
|
83 |
+
$('input#qlwcdc_add_product_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
84 |
+
}
|
85 |
+
});
|
86 |
+
$('select#qlwcdc_add_product_cart').change(function () {
|
87 |
+
if ('ajax' === $(this).val()) {
|
88 |
+
$('select#qlwcdc_add_product_cart_ajax_button').closest('tr, p').fadeIn();
|
89 |
+
$('select#qlwcdc_add_product_cart_ajax_message').closest('tr, p').fadeIn();
|
90 |
+
} else {
|
91 |
+
$('select#qlwcdc_add_product_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
92 |
+
$('select#qlwcdc_add_product_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
93 |
+
}
|
94 |
+
if ('redirect' === $(this).val()) {
|
95 |
+
$('select#qlwcdc_add_product_cart_redirect_page').closest('tr, p').fadeIn();
|
96 |
+
} else {
|
97 |
+
$('select#qlwcdc_add_product_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
98 |
+
}
|
99 |
+
$('select#qlwcdc_add_product_cart_redirect_page').change();
|
100 |
+
}).change();*/
|
101 |
+
$('select#qlwcdc_add_product_quick_purchase').change(function () {
|
102 |
+
if ('yes' === $(this).val()) {
|
103 |
+
$('select#qlwcdc_add_product_quick_purchase_to').closest('tr, p').fadeIn();
|
104 |
+
$('input#qlwcdc_add_product_quick_purchase_class').closest('tr, p').fadeIn();
|
105 |
+
$('input#qlwcdc_add_product_quick_purchase_text').closest('tr, p').fadeIn();
|
106 |
+
} else {
|
107 |
+
$('select#qlwcdc_add_product_quick_purchase_to').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
108 |
+
$('input#qlwcdc_add_product_quick_purchase_class').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
109 |
+
$('input#qlwcdc_add_product_quick_purchase_text').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
110 |
+
}
|
111 |
+
}).change();
|
112 |
+
$('select#qlwcdc_add_product_text').change(function () {
|
113 |
+
if ('yes' === $(this).val()) {
|
114 |
+
$('input#qlwcdc_add_product_text_content').closest('tr, p').fadeIn();
|
115 |
+
} else {
|
116 |
+
$('input#qlwcdc_add_product_text_content').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
117 |
+
}
|
118 |
+
}).change();
|
119 |
+
// Checkout
|
120 |
+
// -----------------------------------------------------------------
|
121 |
+
$('select#qlwcdc_add_checkout_cart').change(function () {
|
122 |
+
if ('yes' === $(this).val()) {
|
123 |
+
$('select#qlwcdc_add_checkout_cart_fields').closest('tr, p').fadeIn();
|
124 |
+
$('input#qlwcdc_add_checkout_cart_class').closest('tr, p').fadeIn();
|
125 |
+
} else {
|
126 |
+
$('select#qlwcdc_add_checkout_cart_fields').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
127 |
+
$('input#qlwcdc_add_checkout_cart_class').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
128 |
+
}
|
129 |
+
}).change();
|
130 |
+
});
|
131 |
+
}(jQuery));
|
assets/backend/qlwcdc-admin.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(a){a(window).on("load",function(b){a("select#qlwcdc_add_to_cart_redirect_page").change(function(){if("url"===a(this).val()&&"yes"==a("select#qlwcdc_add_to_cart_redirect").val()){a("input#qlwcdc_add_to_cart_redirect_url").closest("tr, p").fadeIn()}else{a("input#qlwcdc_add_to_cart_redirect_url").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}});a("select#qlwcdc_add_to_cart_redirect").change(function(){if("yes"===a(this).val()){a("select#qlwcdc_add_to_cart_redirect_page").change();a("select#qlwcdc_add_to_cart_redirect_page").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_to_cart_redirect_page").change();a("select#qlwcdc_add_to_cart_redirect_page").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}}).change();a("select#qlwcdc_add_to_cart_redirect_page").change(function(){if("url"===a(this).val()&&"redirect"==a("select#qlwcdc_add_to_cart").val()){a("input#qlwcdc_add_to_cart_redirect_url").closest("tr, p").fadeIn()}else{a("input#qlwcdc_add_to_cart_redirect_url").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}});a("select#qlwcdc_add_to_cart").change(function(){if("ajax"===a(this).val()){a("select#qlwcdc_add_to_cart_ajax_button").closest("tr, p").fadeIn();a("select#qlwcdc_add_to_cart_ajax_message").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_to_cart_ajax_button").closest("tr:not(.qlwcdc-premium-field), p").fadeOut();a("select#qlwcdc_add_to_cart_ajax_message").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}if("redirect"===a(this).val()){a("select#qlwcdc_add_to_cart_redirect_page").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_to_cart_redirect_page").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}a("select#qlwcdc_add_to_cart_redirect_page").change()}).change();a("select#qlwcdc_add_archive_text").change(function(){if("yes"===a(this).val()){a("select#qlwcdc_add_archive_text_in").closest("tr, p").fadeIn();a("input#qlwcdc_add_archive_text_content").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_archive_text_in").closest("tr:not(.qlwcdc-premium-field), p").fadeOut();a("input#qlwcdc_add_archive_text_content").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}}).change();a("select#qlwcdc_add_product_quick_purchase").change(function(){if("yes"===a(this).val()){a("select#qlwcdc_add_product_quick_purchase_to").closest("tr, p").fadeIn();a("input#qlwcdc_add_product_quick_purchase_class").closest("tr, p").fadeIn();a("input#qlwcdc_add_product_quick_purchase_text").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_product_quick_purchase_to").closest("tr:not(.qlwcdc-premium-field), p").fadeOut();a("input#qlwcdc_add_product_quick_purchase_class").closest("tr:not(.qlwcdc-premium-field), p").fadeOut();a("input#qlwcdc_add_product_quick_purchase_text").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}}).change();a("select#qlwcdc_add_product_text").change(function(){if("yes"===a(this).val()){a("input#qlwcdc_add_product_text_content").closest("tr, p").fadeIn()}else{a("input#qlwcdc_add_product_text_content").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}}).change();a("select#qlwcdc_add_checkout_cart").change(function(){if("yes"===a(this).val()){a("select#qlwcdc_add_checkout_cart_fields").closest("tr, p").fadeIn();a("input#qlwcdc_add_checkout_cart_class").closest("tr, p").fadeIn()}else{a("select#qlwcdc_add_checkout_cart_fields").closest("tr:not(.qlwcdc-premium-field), p").fadeOut();a("input#qlwcdc_add_checkout_cart_class").closest("tr:not(.qlwcdc-premium-field), p").fadeOut()}}).change()})}(jQuery));
|
assets/{img → frontend/img}/checkout.png
RENAMED
File without changes
|
assets/{img → frontend/img}/logo.jpg
RENAMED
File without changes
|
assets/{img → frontend/img}/modal.png
RENAMED
File without changes
|
assets/{qlwcdc.css → frontend/qlwcdc.css}
RENAMED
File without changes
|
assets/{qlwcdc.js → frontend/qlwcdc.js}
RENAMED
@@ -59,7 +59,10 @@
|
|
59 |
$modal.removeClass('closing');
|
60 |
}, 600);
|
61 |
});
|
62 |
-
$modal.find('.modal-content').replaceWith($response)
|
|
|
|
|
|
|
63 |
}
|
64 |
});
|
65 |
}
|
@@ -68,8 +71,11 @@
|
|
68 |
});
|
69 |
|
70 |
$('#qlwcdc_quick_view_modal').on('click', function (e) {
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
$modal.addClass('closing');
|
74 |
setTimeout(function () {
|
75 |
$modal.removeClass('open');
|
@@ -84,6 +90,8 @@
|
|
84 |
|
85 |
if ($button.hasClass('qlwcdc_quick_purchase')) {
|
86 |
|
|
|
|
|
87 |
var $form = $(this),
|
88 |
product_id = $form.find('[name=add-to-cart]').val() || 0,
|
89 |
variation_id = $form.find('[name=variation_id]').val() || 0,
|
@@ -126,11 +134,7 @@
|
|
126 |
}
|
127 |
|
128 |
if ($button.attr('data-href') != 'undefined') {
|
129 |
-
|
130 |
-
window.location = $button.attr('data-href');
|
131 |
-
|
132 |
-
return false;
|
133 |
-
|
134 |
}
|
135 |
}
|
136 |
|
59 |
$modal.removeClass('closing');
|
60 |
}, 600);
|
61 |
});
|
62 |
+
$modal.find('.modal-content').replaceWith($response);
|
63 |
+
if (typeof wc_add_to_cart_variation_params !== 'undefined') {
|
64 |
+
$modal.find('.variations_form').wc_variation_form();
|
65 |
+
}
|
66 |
}
|
67 |
});
|
68 |
}
|
71 |
});
|
72 |
|
73 |
$('#qlwcdc_quick_view_modal').on('click', function (e) {
|
74 |
+
|
75 |
+
var $context = $(e.target),
|
76 |
+
$modal = $(e.delegateTarget);
|
77 |
+
|
78 |
+
if ($context.hasClass('modal-dialog')) {
|
79 |
$modal.addClass('closing');
|
80 |
setTimeout(function () {
|
81 |
$modal.removeClass('open');
|
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,
|
134 |
}
|
135 |
|
136 |
if ($button.attr('data-href') != 'undefined') {
|
137 |
+
document.location.href = $button.attr('data-href');
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
|
assets/{qlwcdc.min.css → frontend/qlwcdc.min.css}
RENAMED
File without changes
|
assets/frontend/qlwcdc.min.js
ADDED
@@ -0,0 +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);
|
assets/qlwcdc.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
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)}})}return false});d("#qlwcdc_quick_view_modal").on("click",function(h){var g=d(this);if(!g.closest(".modal-body").length){g.addClass("closing");setTimeout(function(){g.removeClass("open");g.removeClass("closing")},600)}});d(document).on("submit","form.cart",function(k){var g=d(k.delegateTarget.activeElement);if(g.hasClass("qlwcdc_quick_purchase")){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"){window.location=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);
|
|
|
|
includes/checkout.php
CHANGED
@@ -212,6 +212,7 @@ if (!class_exists('QLWCDC_Checkout')) {
|
|
212 |
|
213 |
if ($remove = get_option('qlwcdc_remove_checkout_fields', array())) {
|
214 |
foreach ($remove as $id => $key) {
|
|
|
215 |
unset($fields['billing']['billing_' . $key]);
|
216 |
unset($fields['shipping']['shipping_' . $key]);
|
217 |
}
|
212 |
|
213 |
if ($remove = get_option('qlwcdc_remove_checkout_fields', array())) {
|
214 |
foreach ($remove as $id => $key) {
|
215 |
+
// We need to remove both fields otherwise will be required
|
216 |
unset($fields['billing']['billing_' . $key]);
|
217 |
unset($fields['shipping']['shipping_' . $key]);
|
218 |
}
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -51,6 +51,14 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
|
|
51 |
|
52 |
[https://quadlayers.com/documentation/woocommerce-direct-checkout/changelog/](https://quadlayers.com/documentation/woocommerce-direct-checkout/changelog/)
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
= 2.2.1 =
|
55 |
* Fix. WooCommerce Direct Checkout documentation link
|
56 |
|
@@ -58,8 +66,6 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
|
|
58 |
* Fix. WooCommerce Quick Purchase button empty
|
59 |
* Fix. WooCommerce Stripe card form update
|
60 |
|
61 |
-
== Changelog ==
|
62 |
-
|
63 |
= 2.1.9 =
|
64 |
* Fix. WooCommerce Stripe card form update
|
65 |
|
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 |
|
51 |
|
52 |
[https://quadlayers.com/documentation/woocommerce-direct-checkout/changelog/](https://quadlayers.com/documentation/woocommerce-direct-checkout/changelog/)
|
53 |
|
54 |
+
== Changelog ==
|
55 |
+
|
56 |
+
= 2.2.3 =
|
57 |
+
* Fix. WooCommerce Direct Checkout quick view for variations
|
58 |
+
|
59 |
+
= 2.2.2 =
|
60 |
+
* Fix. WooCommerce Direct Checkout quick button redirect in safari
|
61 |
+
|
62 |
= 2.2.1 =
|
63 |
* Fix. WooCommerce Direct Checkout documentation link
|
64 |
|
66 |
* Fix. WooCommerce Quick Purchase button empty
|
67 |
* Fix. WooCommerce Stripe card form update
|
68 |
|
|
|
|
|
69 |
= 2.1.9 =
|
70 |
* Fix. WooCommerce Stripe card form update
|
71 |
|
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.
|
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.
|
19 |
}
|
20 |
if (!defined('QLWCDC_PLUGIN_FILE')) {
|
21 |
define('QLWCDC_PLUGIN_FILE', __FILE__);
|
@@ -118,6 +118,12 @@ if (!class_exists('QLWCDC')) {
|
|
118 |
}
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
function get_product_option($product_id = null, $meta_key = null, $default = null) {
|
122 |
|
123 |
if (!$meta_key) {
|
@@ -181,18 +187,36 @@ if (!class_exists('QLWCDC')) {
|
|
181 |
return $fields;
|
182 |
}
|
183 |
|
184 |
-
function
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
187 |
wp_localize_script(QLWCDC_DOMAIN, QLWCDC_DOMAIN, array(
|
188 |
'nonce' => wp_create_nonce(QLWCDC_DOMAIN),
|
189 |
-
//'queried_object_id' => get_queried_object_id(),
|
190 |
-
//'add_product_cart' => $this->get_product_option(get_queried_object_id(), 'qlwcdc_add_product_cart', 'no'),
|
191 |
'delay' => 200,
|
192 |
'timeout' => null)
|
193 |
);
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
function remove_premium() {
|
197 |
?>
|
198 |
<script>
|
@@ -219,140 +243,9 @@ if (!class_exists('QLWCDC')) {
|
|
219 |
<?php
|
220 |
}
|
221 |
|
222 |
-
function
|
223 |
?>
|
224 |
<script>
|
225 |
-
(function ($) {
|
226 |
-
'use strict';
|
227 |
-
$(window).on('load', function (e) {
|
228 |
-
// General
|
229 |
-
// -----------------------------------------------------------------
|
230 |
-
$('select#qlwcdc_add_to_cart_redirect_page').change(function () {
|
231 |
-
if ('url' === $(this).val() && 'yes' == $('select#qlwcdc_add_to_cart_redirect').val()) {
|
232 |
-
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr, p').fadeIn();
|
233 |
-
} else {
|
234 |
-
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
235 |
-
}
|
236 |
-
});
|
237 |
-
$('select#qlwcdc_add_to_cart_redirect').change(function () {
|
238 |
-
if ('yes' === $(this).val()) {
|
239 |
-
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
240 |
-
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr, p').fadeIn();
|
241 |
-
} else {
|
242 |
-
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
243 |
-
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
244 |
-
}
|
245 |
-
}).change();
|
246 |
-
$('select#qlwcdc_add_to_cart_redirect_page').change(function () {
|
247 |
-
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_to_cart').val()) {
|
248 |
-
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr, p').fadeIn();
|
249 |
-
} else {
|
250 |
-
$('input#qlwcdc_add_to_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
251 |
-
}
|
252 |
-
});
|
253 |
-
$('select#qlwcdc_add_to_cart').change(function () {
|
254 |
-
if ('ajax' === $(this).val()) {
|
255 |
-
$('select#qlwcdc_add_to_cart_ajax_button').closest('tr, p').fadeIn();
|
256 |
-
$('select#qlwcdc_add_to_cart_ajax_message').closest('tr, p').fadeIn();
|
257 |
-
} else {
|
258 |
-
$('select#qlwcdc_add_to_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
259 |
-
$('select#qlwcdc_add_to_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
260 |
-
}
|
261 |
-
if ('redirect' === $(this).val()) {
|
262 |
-
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr, p').fadeIn();
|
263 |
-
} else {
|
264 |
-
$('select#qlwcdc_add_to_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
265 |
-
}
|
266 |
-
$('select#qlwcdc_add_to_cart_redirect_page').change();
|
267 |
-
}).change();
|
268 |
-
// Archive
|
269 |
-
// -----------------------------------------------------------------
|
270 |
-
/*$('select#qlwcdc_add_archive_cart_redirect_page').change(function () {
|
271 |
-
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_archive_cart').val()) {
|
272 |
-
$('input#qlwcdc_add_archive_cart_redirect_url').closest('tr, p').fadeIn();
|
273 |
-
} else {
|
274 |
-
$('input#qlwcdc_add_archive_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
275 |
-
}
|
276 |
-
});
|
277 |
-
$('select#qlwcdc_add_archive_cart').change(function () {
|
278 |
-
if ('ajax' === $(this).val()) {
|
279 |
-
$('select#qlwcdc_add_archive_cart_ajax_button').closest('tr, p').fadeIn();
|
280 |
-
$('select#qlwcdc_add_archive_cart_ajax_message').closest('tr, p').fadeIn();
|
281 |
-
} else {
|
282 |
-
$('select#qlwcdc_add_archive_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
283 |
-
$('select#qlwcdc_add_archive_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
284 |
-
}
|
285 |
-
if ('redirect' === $(this).val()) {
|
286 |
-
$('select#qlwcdc_add_archive_cart_redirect_page').closest('tr, p').fadeIn();
|
287 |
-
} else {
|
288 |
-
$('select#qlwcdc_add_archive_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
289 |
-
}
|
290 |
-
$('select#qlwcdc_add_archive_cart_redirect_page').change();
|
291 |
-
}).change();*/
|
292 |
-
$('select#qlwcdc_add_archive_text').change(function () {
|
293 |
-
if ('yes' === $(this).val()) {
|
294 |
-
$('select#qlwcdc_add_archive_text_in').closest('tr, p').fadeIn();
|
295 |
-
$('input#qlwcdc_add_archive_text_content').closest('tr, p').fadeIn();
|
296 |
-
} else {
|
297 |
-
$('select#qlwcdc_add_archive_text_in').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
298 |
-
$('input#qlwcdc_add_archive_text_content').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
299 |
-
}
|
300 |
-
}).change();
|
301 |
-
// Product
|
302 |
-
// -----------------------------------------------------------------
|
303 |
-
/*$('select#qlwcdc_add_product_cart_redirect_page').change(function () {
|
304 |
-
if ('url' === $(this).val() && 'redirect' == $('select#qlwcdc_add_product_cart').val()) {
|
305 |
-
$('input#qlwcdc_add_product_cart_redirect_url').closest('tr, p').fadeIn();
|
306 |
-
} else {
|
307 |
-
$('input#qlwcdc_add_product_cart_redirect_url').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
308 |
-
}
|
309 |
-
});
|
310 |
-
$('select#qlwcdc_add_product_cart').change(function () {
|
311 |
-
if ('ajax' === $(this).val()) {
|
312 |
-
$('select#qlwcdc_add_product_cart_ajax_button').closest('tr, p').fadeIn();
|
313 |
-
$('select#qlwcdc_add_product_cart_ajax_message').closest('tr, p').fadeIn();
|
314 |
-
} else {
|
315 |
-
$('select#qlwcdc_add_product_cart_ajax_button').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
316 |
-
$('select#qlwcdc_add_product_cart_ajax_message').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
317 |
-
}
|
318 |
-
if ('redirect' === $(this).val()) {
|
319 |
-
$('select#qlwcdc_add_product_cart_redirect_page').closest('tr, p').fadeIn();
|
320 |
-
} else {
|
321 |
-
$('select#qlwcdc_add_product_cart_redirect_page').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
322 |
-
}
|
323 |
-
$('select#qlwcdc_add_product_cart_redirect_page').change();
|
324 |
-
}).change();*/
|
325 |
-
$('select#qlwcdc_add_product_quick_purchase').change(function () {
|
326 |
-
if ('yes' === $(this).val()) {
|
327 |
-
$('select#qlwcdc_add_product_quick_purchase_to').closest('tr, p').fadeIn();
|
328 |
-
$('input#qlwcdc_add_product_quick_purchase_class').closest('tr, p').fadeIn();
|
329 |
-
$('input#qlwcdc_add_product_quick_purchase_text').closest('tr, p').fadeIn();
|
330 |
-
} else {
|
331 |
-
$('select#qlwcdc_add_product_quick_purchase_to').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
332 |
-
$('input#qlwcdc_add_product_quick_purchase_class').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
333 |
-
$('input#qlwcdc_add_product_quick_purchase_text').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
334 |
-
}
|
335 |
-
}).change();
|
336 |
-
$('select#qlwcdc_add_product_text').change(function () {
|
337 |
-
if ('yes' === $(this).val()) {
|
338 |
-
$('input#qlwcdc_add_product_text_content').closest('tr, p').fadeIn();
|
339 |
-
} else {
|
340 |
-
$('input#qlwcdc_add_product_text_content').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
341 |
-
}
|
342 |
-
}).change();
|
343 |
-
// Checkout
|
344 |
-
// -----------------------------------------------------------------
|
345 |
-
$('select#qlwcdc_add_checkout_cart').change(function () {
|
346 |
-
if ('yes' === $(this).val()) {
|
347 |
-
$('select#qlwcdc_add_checkout_cart_fields').closest('tr, p').fadeIn();
|
348 |
-
$('input#qlwcdc_add_checkout_cart_class').closest('tr, p').fadeIn();
|
349 |
-
} else {
|
350 |
-
$('select#qlwcdc_add_checkout_cart_fields').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
351 |
-
$('input#qlwcdc_add_checkout_cart_class').closest('tr:not(.qlwcdc-premium-field), p').fadeOut();
|
352 |
-
}
|
353 |
-
}).change();
|
354 |
-
});
|
355 |
-
}(jQuery));
|
356 |
</script>
|
357 |
<?php
|
358 |
}
|
@@ -379,11 +272,12 @@ if (!class_exists('QLWCDC')) {
|
|
379 |
|
380 |
function init() {
|
381 |
add_action('wp_ajax_qlwcdc_dismiss_notice', array($this, 'ajax_dismiss_notice'));
|
382 |
-
add_action('wp_enqueue_scripts', array($this, '
|
|
|
383 |
add_action('admin_notices', array($this, 'add_notices'));
|
384 |
add_action('admin_menu', array(&$this, 'add_menu_page'));
|
385 |
add_action('admin_footer', array($this, 'remove_premium'));
|
386 |
-
add_action('admin_footer', array($this, '
|
387 |
add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
|
388 |
add_filter('woocommerce_sections_qlwcdc', array($this, 'add_sections'));
|
389 |
add_action('woocommerce_sections_qlwcdc', array($this, 'add_settings'));
|
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 |
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__);
|
118 |
}
|
119 |
}
|
120 |
|
121 |
+
public static function is_min() {
|
122 |
+
if (!defined('SCRIPT_DEBUG') || !SCRIPT_DEBUG) {
|
123 |
+
return '.min';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
function get_product_option($product_id = null, $meta_key = null, $default = null) {
|
128 |
|
129 |
if (!$meta_key) {
|
187 |
return $fields;
|
188 |
}
|
189 |
|
190 |
+
function register_scripts() {
|
191 |
+
|
192 |
+
wp_register_script(QLWCDC_DOMAIN . '-admin', plugins_url('/assets/backend/qlwcdc' . self::is_min() . '-admin.js', QLWCDC_PLUGIN_FILE), array('jquery'), QLWCDC_PLUGIN_VERSION, true);
|
193 |
+
|
194 |
+
wp_register_style(QLWCDC_DOMAIN, plugins_url('/assets/frontend/qlwcdc' . self::is_min() . '.css', QLWCDC_PLUGIN_FILE), array(), QLWCDC_PLUGIN_VERSION, 'all');
|
195 |
+
|
196 |
+
wp_register_script(QLWCDC_DOMAIN, plugins_url('/assets/frontend/qlwcdc' . self::is_min() . '.js', QLWCDC_PLUGIN_FILE), array('jquery', 'wc-add-to-cart-variation'), QLWCDC_PLUGIN_VERSION, true);
|
197 |
+
|
198 |
wp_localize_script(QLWCDC_DOMAIN, QLWCDC_DOMAIN, array(
|
199 |
'nonce' => wp_create_nonce(QLWCDC_DOMAIN),
|
|
|
|
|
200 |
'delay' => 200,
|
201 |
'timeout' => null)
|
202 |
);
|
203 |
}
|
204 |
|
205 |
+
function enqueue_frontend_scripts() {
|
206 |
+
|
207 |
+
$this->register_scripts();
|
208 |
+
|
209 |
+
wp_enqueue_style(QLWCDC_DOMAIN);
|
210 |
+
wp_enqueue_script(QLWCDC_DOMAIN);
|
211 |
+
}
|
212 |
+
|
213 |
+
function enqueue_admin_scripts() {
|
214 |
+
|
215 |
+
$this->register_scripts();
|
216 |
+
|
217 |
+
wp_enqueue_script(QLWCDC_DOMAIN . '-admin');
|
218 |
+
}
|
219 |
+
|
220 |
function remove_premium() {
|
221 |
?>
|
222 |
<script>
|
243 |
<?php
|
244 |
}
|
245 |
|
246 |
+
function enqueue_footer_scripts() {
|
247 |
?>
|
248 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
</script>
|
250 |
<?php
|
251 |
}
|
272 |
|
273 |
function init() {
|
274 |
add_action('wp_ajax_qlwcdc_dismiss_notice', array($this, 'ajax_dismiss_notice'));
|
275 |
+
add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'), 99);
|
276 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 99);
|
277 |
add_action('admin_notices', array($this, 'add_notices'));
|
278 |
add_action('admin_menu', array(&$this, 'add_menu_page'));
|
279 |
add_action('admin_footer', array($this, 'remove_premium'));
|
280 |
+
//add_action('admin_footer', array($this, 'enqueue_footer_scripts'));
|
281 |
add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
|
282 |
add_filter('woocommerce_sections_qlwcdc', array($this, 'add_sections'));
|
283 |
add_action('woocommerce_sections_qlwcdc', array($this, 'add_settings'));
|