Version Description
- Fix: Load WPML Helper settings filter for settings screen only to avoid problems during admin actions
- Fix: Do not force tax calculation for fees if customer is a vat exempt
- Improvement: Keep hidden terms checkbox (woo builtin) in sync with GZD checkbox to avoid plugin conflicts
- Improvement: Use higher priority to refresh order fragments to avoid plugin conflicts
Download this release
Release Info
Developer | vendidero |
Plugin | WooCommerce Germanized |
Version | 2.2.2 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 2.2.2
- assets/js/admin/settings.js +124 -85
- assets/js/admin/settings.min.js +1 -1
- assets/js/checkout.js +82 -27
- assets/js/checkout.min.js +1 -1
- includes/admin/class-wc-gzd-admin.php +238 -190
- includes/class-wc-gzd-checkout.php +73 -57
- includes/compatibility/class-wc-gzd-compatibility-wpml.php +18 -7
- includes/wc-gzd-template-functions.php +1 -1
- readme.txt +8 -2
- woocommerce-germanized.php +14 -5
assets/js/admin/settings.js
CHANGED
@@ -1,90 +1,129 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
});
|
16 |
-
}
|
17 |
-
} catch( err ) {
|
18 |
-
// If select2 failed (conflict?) log the error but don't stop other scripts breaking.
|
19 |
-
window.console.log( err );
|
20 |
-
}
|
21 |
-
|
22 |
-
$( document ).on( 'change', 'select#woocommerce_gzd_legal_checkboxes_settings_parcel_delivery_show_special', function() {
|
23 |
-
var val = $( this ).val();
|
24 |
-
|
25 |
-
if ( 'shipping_methods' === val ) {
|
26 |
-
$( 'select#woocommerce_gzd_legal_checkboxes_settings_parcel_delivery_show_shipping_methods' ).parents( 'tr' ).show();
|
27 |
-
} else {
|
28 |
-
$( 'select#woocommerce_gzd_legal_checkboxes_settings_parcel_delivery_show_shipping_methods' ).parents( 'tr' ).hide();
|
29 |
-
}
|
30 |
-
});
|
31 |
-
|
32 |
-
$( document ).on( 'change', 'input#woocommerce_gzd_order_pay_now_button', function() {
|
33 |
-
|
34 |
-
if ( $( this ).is( ':checked' ) ) {
|
35 |
-
$( 'select#woocommerce_gzd_order_pay_now_button_disabled_methods' ).parents( 'tr' ).show();
|
36 |
-
} else {
|
37 |
-
$( 'select#woocommerce_gzd_order_pay_now_button_disabled_methods' ).parents( 'tr' ).hide();
|
38 |
}
|
39 |
-
}
|
40 |
-
|
41 |
-
$( 'select#woocommerce_gzd_legal_checkboxes_settings_parcel_delivery_show_special' ).trigger( 'change' );
|
42 |
-
$( 'input#woocommerce_gzd_order_pay_now_button' ).trigger( 'change' );
|
43 |
-
|
44 |
-
$( document ).on( 'change', 'input[name=woocommerce_gzd_dispute_resolution_type]', function() {
|
45 |
-
|
46 |
-
var val = $( this ).val();
|
47 |
-
var text = $( '#woocommerce_gzd_alternative_complaints_text_' + val );
|
48 |
-
|
49 |
-
$( '[id^=woocommerce_gzd_alternative_complaints_text_]' ).parents( 'tr' ).hide();
|
50 |
-
$( '#woocommerce_gzd_alternative_complaints_text_' + val ).parents( 'tr' ).show();
|
51 |
|
|
|
|
|
52 |
});
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
if ( $( '#woocommerce_gzd_mail_attach_imprint' ).length > 0 ) {
|
57 |
-
|
58 |
-
var table = $( '#woocommerce_gzd_mail_attach_imprint' ).parents( 'table' );
|
59 |
-
|
60 |
-
$( table ).find( 'tbody' ).sortable({
|
61 |
-
|
62 |
-
items: 'tr',
|
63 |
-
cursor: 'move',
|
64 |
-
axis: 'y',
|
65 |
-
handle: 'td, th',
|
66 |
-
scrollSensitivity: 40,
|
67 |
-
helper:function(e,ui){
|
68 |
-
ui.children().each(function(){
|
69 |
-
jQuery(this).width(jQuery(this).width());
|
70 |
-
});
|
71 |
-
ui.css('left', '0');
|
72 |
-
return ui;
|
73 |
-
},
|
74 |
-
start:function(event,ui) {
|
75 |
-
ui.item.css('background-color','#f6f6f6');
|
76 |
-
},
|
77 |
-
stop:function(event,ui){
|
78 |
-
ui.item.removeAttr('style');
|
79 |
-
var pages = [];
|
80 |
-
$( table ).find( 'tr select' ).each( function() {
|
81 |
-
pages.push( $(this).attr( 'id' ).replace( 'woocommerce_gzd_mail_attach_', '' ) );
|
82 |
-
});
|
83 |
-
$( '#woocommerce_gzd_mail_attach_order' ).val( pages.join() );
|
84 |
-
}
|
85 |
-
|
86 |
-
});
|
87 |
-
|
88 |
-
}
|
89 |
-
|
90 |
-
});
|
1 |
+
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order */
|
2 |
+
window.germanized = window.germanized || {};
|
3 |
+
|
4 |
+
( function( $, wp, germanized ) {
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Order Data Panel
|
8 |
+
*/
|
9 |
+
germanized.settings = {
|
10 |
+
|
11 |
+
init: function() {
|
12 |
+
|
13 |
+
try {
|
14 |
+
$( document.body ).on( 'wc-enhanced-select-init wc-gzd-enhanced-select-init', this.onEnhancedSelectInit ).trigger( 'wc-gzd-enhanced-select-init' );
|
15 |
+
} catch( err ) {
|
16 |
+
// If select2 failed (conflict?) log the error but don't stop other scripts breaking.
|
17 |
+
window.console.log( err );
|
18 |
+
}
|
19 |
+
|
20 |
+
$( document )
|
21 |
+
.on( 'change', 'select#woocommerce_gzd_checkboxes_parcel_delivery_show_special', this.onParcelDeliveryShowSpecial )
|
22 |
+
.on( 'change', 'input#woocommerce_gzd_order_pay_now_button', this.onChangePayNow )
|
23 |
+
.on( 'change', 'input[name=woocommerce_gzd_dispute_resolution_type]', this.onChangeDisputeResolutionType )
|
24 |
+
.on( 'click', 'span.woocommerce-gzd-input-toggle', this.onInputToogleClick );
|
25 |
+
|
26 |
+
$( 'select#woocommerce_gzd_checkboxes_parcel_delivery_show_special' ).trigger( 'change' );
|
27 |
+
$( 'input#woocommerce_gzd_order_pay_now_button' ).trigger( 'change' );
|
28 |
+
$( 'input[name=woocommerce_gzd_dispute_resolution_type]:checked' ).trigger( 'change' );
|
29 |
+
|
30 |
+
this.initMailSortable();
|
31 |
+
},
|
32 |
+
|
33 |
+
onEnhancedSelectInit: function() {
|
34 |
+
// Tag select
|
35 |
+
$( ':input.wc-gzd-enhanced-tags' ).filter( ':not(.enhanced)' ).each( function () {
|
36 |
+
var select2_args = {
|
37 |
+
minimumResultsForSearch: 10,
|
38 |
+
allowClear: $( this ).data( 'allow_clear' ) ? true : false,
|
39 |
+
placeholder: $( this ).data( 'placeholder' ),
|
40 |
+
tags: true
|
41 |
+
};
|
42 |
+
|
43 |
+
$( this ).selectWoo( select2_args ).addClass( 'enhanced' );
|
44 |
+
});
|
45 |
+
},
|
46 |
+
|
47 |
+
onParcelDeliveryShowSpecial: function() {
|
48 |
+
var val = $( this ).val();
|
49 |
+
|
50 |
+
if ( 'shipping_methods' === val ) {
|
51 |
+
$( 'select#woocommerce_gzd_checkboxes_parcel_delivery_show_shipping_methods' ).parents( 'tr' ).show();
|
52 |
+
} else {
|
53 |
+
$( 'select#woocommerce_gzd_checkboxes_parcel_delivery_show_shipping_methods' ).parents( 'tr' ).hide();
|
54 |
+
}
|
55 |
+
},
|
56 |
+
|
57 |
+
onChangePayNow: function() {
|
58 |
+
if ( $( this ).is( ':checked' ) ) {
|
59 |
+
$( 'select#woocommerce_gzd_order_pay_now_button_disabled_methods' ).parents( 'tr' ).show();
|
60 |
+
} else {
|
61 |
+
$( 'select#woocommerce_gzd_order_pay_now_button_disabled_methods' ).parents( 'tr' ).hide();
|
62 |
+
}
|
63 |
+
},
|
64 |
+
|
65 |
+
onChangeDisputeResolutionType: function() {
|
66 |
+
var val = $( this ).val();
|
67 |
+
var text = $( '#woocommerce_gzd_alternative_complaints_text_' + val );
|
68 |
+
|
69 |
+
$( '[id^=woocommerce_gzd_alternative_complaints_text_]' ).parents( 'tr' ).hide();
|
70 |
+
$( '#woocommerce_gzd_alternative_complaints_text_' + val ).parents( 'tr' ).show();
|
71 |
+
},
|
72 |
+
|
73 |
+
onInputToogleClick: function() {
|
74 |
+
var $toggle = $( this ),
|
75 |
+
$row = $toggle.parents( 'tr' ),
|
76 |
+
$checkbox = $row.find( 'input[type=checkbox]' ),
|
77 |
+
$enabled = $toggle.hasClass( 'woocommerce-input-toggle--enabled' );
|
78 |
+
|
79 |
+
$toggle.removeClass( 'woocommerce-input-toggle--enabled' );
|
80 |
+
$toggle.removeClass( 'woocommerce-input-toggle--disabled' );
|
81 |
+
|
82 |
+
if ( $enabled ) {
|
83 |
+
$checkbox.prop( 'checked', false );
|
84 |
+
$toggle.addClass( 'woocommerce-input-toggle--disabled' );
|
85 |
+
} else {
|
86 |
+
$checkbox.prop( 'checked', true );
|
87 |
+
$toggle.addClass( 'woocommerce-input-toggle--enabled' );
|
88 |
+
}
|
89 |
+
|
90 |
+
$checkbox.trigger( 'change' );
|
91 |
+
},
|
92 |
+
|
93 |
+
initMailSortable: function() {
|
94 |
+
if ( $( '#woocommerce_gzd_mail_attach_imprint' ).length > 0 ) {
|
95 |
+
var table = $( '#woocommerce_gzd_mail_attach_imprint' ).parents( 'table' );
|
96 |
+
$( table ).find( 'tbody' ).sortable({
|
97 |
+
items: 'tr',
|
98 |
+
cursor: 'move',
|
99 |
+
axis: 'y',
|
100 |
+
handle: 'td, th',
|
101 |
+
scrollSensitivity: 40,
|
102 |
+
helper:function(e,ui){
|
103 |
+
ui.children().each(function(){
|
104 |
+
jQuery(this).width(jQuery(this).width());
|
105 |
+
});
|
106 |
+
ui.css('left', '0');
|
107 |
+
return ui;
|
108 |
+
},
|
109 |
+
start:function(event,ui) {
|
110 |
+
ui.item.css('background-color','#f6f6f6');
|
111 |
+
},
|
112 |
+
stop:function(event,ui){
|
113 |
+
ui.item.removeAttr('style');
|
114 |
+
var pages = [];
|
115 |
+
$( table ).find( 'tr select' ).each( function() {
|
116 |
+
pages.push( $(this).attr( 'id' ).replace( 'woocommerce_gzd_mail_attach_', '' ) );
|
117 |
+
});
|
118 |
+
$( '#woocommerce_gzd_mail_attach_order' ).val( pages.join() );
|
119 |
+
}
|
120 |
});
|
121 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
+
$( document ).ready( function() {
|
126 |
+
germanized.settings.init();
|
127 |
});
|
128 |
|
129 |
+
})( jQuery, wp, window.germanized );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/admin/settings.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
window.germanized=window.germanized||{},function(a,b,c){c.settings={init:function(){try{a(document.body).on("wc-enhanced-select-init wc-gzd-enhanced-select-init",this.onEnhancedSelectInit).trigger("wc-gzd-enhanced-select-init")}catch(b){window.console.log(b)}a(document).on("change","select#woocommerce_gzd_checkboxes_parcel_delivery_show_special",this.onParcelDeliveryShowSpecial).on("change","input#woocommerce_gzd_order_pay_now_button",this.onChangePayNow).on("change","input[name=woocommerce_gzd_dispute_resolution_type]",this.onChangeDisputeResolutionType).on("click","span.woocommerce-gzd-input-toggle",this.onInputToogleClick),a("select#woocommerce_gzd_checkboxes_parcel_delivery_show_special").trigger("change"),a("input#woocommerce_gzd_order_pay_now_button").trigger("change"),a("input[name=woocommerce_gzd_dispute_resolution_type]:checked").trigger("change"),this.initMailSortable()},onEnhancedSelectInit:function(){a(":input.wc-gzd-enhanced-tags").filter(":not(.enhanced)").each(function(){var b={minimumResultsForSearch:10,allowClear:a(this).data("allow_clear")?!0:!1,placeholder:a(this).data("placeholder"),tags:!0};a(this).selectWoo(b).addClass("enhanced")})},onParcelDeliveryShowSpecial:function(){var b=a(this).val();"shipping_methods"===b?a("select#woocommerce_gzd_checkboxes_parcel_delivery_show_shipping_methods").parents("tr").show():a("select#woocommerce_gzd_checkboxes_parcel_delivery_show_shipping_methods").parents("tr").hide()},onChangePayNow:function(){a(this).is(":checked")?a("select#woocommerce_gzd_order_pay_now_button_disabled_methods").parents("tr").show():a("select#woocommerce_gzd_order_pay_now_button_disabled_methods").parents("tr").hide()},onChangeDisputeResolutionType:function(){{var b=a(this).val();a("#woocommerce_gzd_alternative_complaints_text_"+b)}a("[id^=woocommerce_gzd_alternative_complaints_text_]").parents("tr").hide(),a("#woocommerce_gzd_alternative_complaints_text_"+b).parents("tr").show()},onInputToogleClick:function(){var b=a(this),c=b.parents("tr"),d=c.find("input[type=checkbox]"),e=b.hasClass("woocommerce-input-toggle--enabled");b.removeClass("woocommerce-input-toggle--enabled"),b.removeClass("woocommerce-input-toggle--disabled"),e?(d.prop("checked",!1),b.addClass("woocommerce-input-toggle--disabled")):(d.prop("checked",!0),b.addClass("woocommerce-input-toggle--enabled")),d.trigger("change")},initMailSortable:function(){if(a("#woocommerce_gzd_mail_attach_imprint").length>0){var b=a("#woocommerce_gzd_mail_attach_imprint").parents("table");a(b).find("tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td, th",scrollSensitivity:40,helper:function(a,b){return b.children().each(function(){jQuery(this).width(jQuery(this).width())}),b.css("left","0"),b},start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(c,d){d.item.removeAttr("style");var e=[];a(b).find("tr select").each(function(){e.push(a(this).attr("id").replace("woocommerce_gzd_mail_attach_",""))}),a("#woocommerce_gzd_mail_attach_order").val(e.join())}})}}},a(document).ready(function(){c.settings.init()})}(jQuery,wp,window.germanized);
|
assets/js/checkout.js
CHANGED
@@ -1,28 +1,83 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
-
}
|
28 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order */
|
2 |
+
window.germanized = window.germanized || {};
|
3 |
+
|
4 |
+
( function( $, germanized ) {
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Order Data Panel
|
8 |
+
*/
|
9 |
+
germanized.checkout = {
|
10 |
+
|
11 |
+
params: {},
|
12 |
+
|
13 |
+
init: function() {
|
14 |
+
this.params = wc_gzd_checkout_params;
|
15 |
+
|
16 |
+
if ( $( '.payment_methods:first' ).parents( '#order_review' ).length ) {
|
17 |
+
$( document ).on( 'change', '.payment_methods input[name="payment_method"]', this.onChangePaymentMethod );
|
18 |
+
}
|
19 |
+
|
20 |
+
$( 'body' ).bind( 'updated_checkout', this.onUpdateCheckout );
|
21 |
+
|
22 |
+
if ( this.params.adjust_heading ) {
|
23 |
+
if ( $( '.woocommerce-checkout' ).find( '#order_review_heading' ).length > 0 ) {
|
24 |
+
$( '.woocommerce-checkout' ).find( '#payment' ).after( $( '.woocommerce-checkout' ).find( '#order_review_heading' ) );
|
25 |
+
$( '.woocommerce-checkout' ).find( '#order_review_heading' ).show();
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( this.params.checkbox_hidden ) {
|
30 |
+
this.maybeSetTermsCheckbox();
|
31 |
+
} else {
|
32 |
+
$( document ).on( 'change', 'input#' + this.params.checkbox_id, this.onChangeLegalCheckbox );
|
33 |
+
}
|
34 |
+
},
|
35 |
+
|
36 |
+
maybeSetTermsCheckbox: function() {
|
37 |
+
var self = germanized.checkout,
|
38 |
+
$checkbox = $( 'input#' + self.params.checkbox_id ),
|
39 |
+
$terms = $( 'input[name=terms]' );
|
40 |
+
|
41 |
+
if ( $terms.length > 0 ) {
|
42 |
+
if ( self.params.checkbox_hidden || $checkbox.is( ':checked' ) ) {
|
43 |
+
$terms.attr( 'checked','checked' ).trigger( 'change' );
|
44 |
+
$terms.prop( 'checked', true ).trigger( 'change' );
|
45 |
+
} else {
|
46 |
+
$terms.attr( 'checked','' ).trigger( 'change' );
|
47 |
+
$terms.prop( 'checked', false ).trigger( 'change' );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
},
|
51 |
+
|
52 |
+
onChangeLegalCheckbox: function() {
|
53 |
+
var self = germanized.checkout;
|
54 |
+
|
55 |
+
self.maybeSetTermsCheckbox();
|
56 |
+
},
|
57 |
+
|
58 |
+
onChangePaymentMethod: function() {
|
59 |
+
$( 'body' ).trigger( 'update_checkout' );
|
60 |
+
},
|
61 |
+
|
62 |
+
onUpdateCheckout: function() {
|
63 |
+
var self = germanized.checkout;
|
64 |
+
|
65 |
+
if ( $( '.wc-gzd-place-order' ).length > 0 ) {
|
66 |
+
if ( $( '.place-order:not(.wc-gzd-place-order)' ).length > 0 ) {
|
67 |
+
// Make sure we are removing the nonce from the old container to the new one.
|
68 |
+
$( '.place-order:not(.wc-gzd-place-order)' ).find( '#_wpnonce' ).appendTo( '.wc-gzd-place-order' );
|
69 |
+
// Woo 3.4
|
70 |
+
$( '.place-order:not(.wc-gzd-place-order)' ).find( '#woocommerce-process-checkout-nonce' ).appendTo( '.wc-gzd-place-order' );
|
71 |
+
}
|
72 |
+
$( '.place-order:not(.wc-gzd-place-order)' ).remove();
|
73 |
+
}
|
74 |
+
|
75 |
+
self.maybeSetTermsCheckbox();
|
76 |
}
|
77 |
+
};
|
78 |
+
|
79 |
+
$( document ).ready( function() {
|
80 |
+
germanized.checkout.init();
|
81 |
+
});
|
82 |
+
|
83 |
+
})( jQuery, window.germanized );
|
assets/js/checkout.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
window.germanized=window.germanized||{},function(a,b){b.checkout={params:{},init:function(){this.params=wc_gzd_checkout_params,a(".payment_methods:first").parents("#order_review").length&&a(document).on("change",'.payment_methods input[name="payment_method"]',this.onChangePaymentMethod),a("body").bind("updated_checkout",this.onUpdateCheckout),this.params.adjust_heading&&a(".woocommerce-checkout").find("#order_review_heading").length>0&&(a(".woocommerce-checkout").find("#payment").after(a(".woocommerce-checkout").find("#order_review_heading")),a(".woocommerce-checkout").find("#order_review_heading").show()),this.params.checkbox_hidden?this.maybeSetTermsCheckbox():a(document).on("change","input#"+this.params.checkbox_id,this.onChangeLegalCheckbox)},maybeSetTermsCheckbox:function(){var c=b.checkout,d=a("input#"+c.params.checkbox_id),e=a("input[name=terms]");e.length>0&&(c.params.checkbox_hidden||d.is(":checked")?(e.attr("checked","checked").trigger("change"),e.prop("checked",!0).trigger("change")):(e.attr("checked","").trigger("change"),e.prop("checked",!1).trigger("change")))},onChangeLegalCheckbox:function(){var a=b.checkout;a.maybeSetTermsCheckbox()},onChangePaymentMethod:function(){a("body").trigger("update_checkout")},onUpdateCheckout:function(){var c=b.checkout;a(".wc-gzd-place-order").length>0&&(a(".place-order:not(.wc-gzd-place-order)").length>0&&(a(".place-order:not(.wc-gzd-place-order)").find("#_wpnonce").appendTo(".wc-gzd-place-order"),a(".place-order:not(.wc-gzd-place-order)").find("#woocommerce-process-checkout-nonce").appendTo(".wc-gzd-place-order")),a(".place-order:not(.wc-gzd-place-order)").remove()),c.maybeSetTermsCheckbox()}},a(document).ready(function(){b.checkout.init()})}(jQuery,window.germanized);
|
includes/admin/class-wc-gzd-admin.php
CHANGED
@@ -42,17 +42,17 @@ class WC_GZD_Admin {
|
|
42 |
public function __wakeup() {
|
43 |
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce-germanized' ), '1.0' );
|
44 |
}
|
45 |
-
|
46 |
public function __construct() {
|
47 |
add_action( 'add_meta_boxes', array( $this, 'add_legal_page_metabox' ) );
|
48 |
add_action( 'add_meta_boxes', array( $this, 'add_product_mini_desc' ) );
|
49 |
-
|
50 |
add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts' ) );
|
51 |
add_action( 'wp_print_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
52 |
add_action( 'wp_print_footer_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
53 |
|
54 |
add_action( 'save_post', array( $this, 'save_legal_page_content' ), 10, 3 );
|
55 |
-
|
56 |
add_filter( 'woocommerce_admin_status_tabs', array( $this, 'set_gzd_status_tab' ) );
|
57 |
add_action( 'woocommerce_admin_status_content_germanized', array( $this, 'status_tab' ) );
|
58 |
|
@@ -64,7 +64,7 @@ class WC_GZD_Admin {
|
|
64 |
add_action( 'admin_init', array( $this, 'check_insert_vat_rates' ) );
|
65 |
add_action( 'admin_init', array( $this, 'check_resend_activation_email' ) );
|
66 |
add_action( 'admin_init', array( $this, 'check_notices' ) );
|
67 |
-
|
68 |
add_filter( 'woocommerce_addons_section_data', array( $this, 'set_addon' ), 10, 2 );
|
69 |
add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'set_order_parcel_delivery_opted_in' ), 10, 1 );
|
70 |
|
@@ -73,53 +73,101 @@ class WC_GZD_Admin {
|
|
73 |
|
74 |
add_filter( 'pre_update_option_wp_page_for_privacy_policy', array( $this, 'pre_update_wp_privacy_option_page' ), 10, 2 );
|
75 |
add_filter( 'pre_update_option_woocommerce_data_security_page_id', array( $this, 'pre_update_gzd_privacy_option_page' ), 10, 2 );
|
76 |
-
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
/**
|
88 |
-
|
89 |
-
|
90 |
* @param $new_value
|
91 |
* @param $old_value
|
92 |
*/
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
-
|
101 |
|
102 |
-
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
public function status_tab() {
|
125 |
WC_GZD_Admin_Status::output();
|
@@ -136,10 +184,10 @@ class WC_GZD_Admin {
|
|
136 |
return;
|
137 |
|
138 |
?>
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
}
|
144 |
|
145 |
public function set_addon( $products, $section_id ) {
|
@@ -181,7 +229,7 @@ class WC_GZD_Admin {
|
|
181 |
wp_register_script( 'wc-gzd-admin-legal-checkboxes', $admin_script_path . 'legal-checkboxes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select' ), WC_GERMANIZED_VERSION );
|
182 |
|
183 |
if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] == 'germanized' ) {
|
184 |
-
|
185 |
wp_enqueue_script( 'wc-gzd-admin' );
|
186 |
|
187 |
$section = 'general';
|
@@ -193,7 +241,7 @@ class WC_GZD_Admin {
|
|
193 |
do_action( 'woocommerce_gzd_load_trusted_shops_script' );
|
194 |
|
195 |
if ( $this->is_tour_enabled( $section ) ) {
|
196 |
-
|
197 |
wp_enqueue_script( 'scrollto' );
|
198 |
wp_enqueue_script( 'tourbus' );
|
199 |
wp_enqueue_script( 'wc-gzd-admin-tour' );
|
@@ -213,16 +261,16 @@ class WC_GZD_Admin {
|
|
213 |
}
|
214 |
|
215 |
public function localize_printed_scripts() {
|
216 |
-
|
217 |
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
|
227 |
public function add_legal_page_metabox() {
|
228 |
add_meta_box( 'wc-gzd-legal-page-email-content', __( 'Optional Email Content', 'woocommerce-germanized' ), array( $this, 'init_legal_page_metabox' ), 'page' );
|
@@ -240,7 +288,7 @@ class WC_GZD_Admin {
|
|
240 |
|
241 |
public function add_product_mini_desc() {
|
242 |
global $post;
|
243 |
-
|
244 |
if ( is_object( $post ) && $post->post_type === 'product' ) {
|
245 |
$product = wc_get_product( $post );
|
246 |
if ( ! $product->is_type( 'variable' ) )
|
@@ -257,7 +305,7 @@ class WC_GZD_Admin {
|
|
257 |
update_post_meta( $post_id, '_legal_text', wc_gzd_sanitize_html_text_field( $_POST[ '_legal_text' ] ) );
|
258 |
else
|
259 |
delete_post_meta( $post_id, '_legal_text' );
|
260 |
-
|
261 |
}
|
262 |
|
263 |
public function init_product_mini_desc( $post ) {
|
@@ -275,33 +323,33 @@ class WC_GZD_Admin {
|
|
275 |
|
276 |
public function check_tour_hide() {
|
277 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'tour' ] ) && isset( $_GET[ 'hide' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-tour-hide' ) ) {
|
278 |
-
|
279 |
if ( ! empty( $_GET[ 'tour' ] ) )
|
280 |
update_option( 'woocommerce_gzd_hide_tour_' . sanitize_text_field( $_GET[ 'tour' ] ), true );
|
281 |
-
else
|
282 |
update_option( 'woocommerce_gzd_hide_tour', true );
|
283 |
-
|
284 |
wp_safe_redirect( remove_query_arg( array( 'hide', 'tour', '_wpnonce' ) ) );
|
285 |
-
|
286 |
} elseif ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'tour' ] ) && isset( $_GET[ 'enable' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-tour-enable' ) ) {
|
287 |
-
|
288 |
-
$setting_sections = array_merge( array(
|
289 |
'general' => '',
|
290 |
'display' => '',
|
291 |
'checkboxes' => '',
|
292 |
'email' => ''
|
293 |
-
|
294 |
-
|
295 |
delete_option( 'woocommerce_gzd_hide_tour' );
|
296 |
-
|
297 |
foreach ( $setting_sections as $section => $name )
|
298 |
delete_option( 'woocommerce_gzd_hide_tour_' . $section );
|
299 |
}
|
300 |
-
|
301 |
|
302 |
-
|
303 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'install-language' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-install-language' ) ) {
|
304 |
-
|
305 |
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
|
306 |
$language = sanitize_text_field( $_GET[ 'install-language' ] );
|
307 |
|
@@ -332,25 +380,25 @@ class WC_GZD_Admin {
|
|
332 |
|
333 |
$checkboxes = $manager->get_checkboxes();
|
334 |
$text_options = array(
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
|
342 |
foreach( $checkboxes as $checkbox ) {
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
|
355 |
// Reinstall options
|
356 |
WC_GZD_Install::create_options();
|
@@ -367,86 +415,86 @@ class WC_GZD_Admin {
|
|
367 |
|
368 |
wc_gzd_get_dependencies()->delete_cached_plugin_header_data();
|
369 |
|
370 |
-
|
371 |
}
|
372 |
}
|
373 |
|
374 |
public function get_complaints_shortcode_pages() {
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
|
384 |
-
|
385 |
-
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
|
405 |
public function check_complaints_shortcode_append() {
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
|
442 |
public function check_notices() {
|
443 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'check-notices' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-notices' ) ) {
|
444 |
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
|
451 |
// Redirect to check for updates
|
452 |
wp_safe_redirect( admin_url( 'admin.php?page=wc-status&tab=germanized' ) );
|
@@ -456,7 +504,7 @@ class WC_GZD_Admin {
|
|
456 |
public function check_insert_vat_rates() {
|
457 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'insert-vat-rates' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-insert-vat-rates' ) ) {
|
458 |
|
459 |
-
|
460 |
WC_GZD_Install::create_virtual_tax_rates();
|
461 |
|
462 |
// Redirect to check for updates
|
@@ -464,62 +512,62 @@ class WC_GZD_Admin {
|
|
464 |
}
|
465 |
}
|
466 |
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
|
479 |
-
|
480 |
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
|
487 |
-
|
488 |
-
|
489 |
|
490 |
-
|
491 |
|
492 |
-
|
493 |
-
|
494 |
|
495 |
-
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
|
503 |
-
|
504 |
|
505 |
-
|
506 |
-
|
507 |
|
508 |
-
|
509 |
-
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
|
521 |
-
|
522 |
-
|
523 |
|
524 |
private function get_setting_key_by_id( $settings, $id, $type = '' ) {
|
525 |
if ( ! empty( $settings ) ) {
|
@@ -551,7 +599,7 @@ class WC_GZD_Admin {
|
|
551 |
}
|
552 |
|
553 |
public function insert_setting_after( $settings, $id, $insert = array(), $type = '' ) {
|
554 |
-
|
555 |
if ( is_numeric( $key ) ) {
|
556 |
$key++;
|
557 |
$settings = array_merge( array_merge( array_slice( $settings, 0, $key, true ), $insert ), array_slice( $settings, $key, count( $settings ) - 1, true ) );
|
42 |
public function __wakeup() {
|
43 |
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'woocommerce-germanized' ), '1.0' );
|
44 |
}
|
45 |
+
|
46 |
public function __construct() {
|
47 |
add_action( 'add_meta_boxes', array( $this, 'add_legal_page_metabox' ) );
|
48 |
add_action( 'add_meta_boxes', array( $this, 'add_product_mini_desc' ) );
|
49 |
+
|
50 |
add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts' ) );
|
51 |
add_action( 'wp_print_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
52 |
add_action( 'wp_print_footer_scripts', array( $this, 'localize_printed_scripts' ), 5 );
|
53 |
|
54 |
add_action( 'save_post', array( $this, 'save_legal_page_content' ), 10, 3 );
|
55 |
+
|
56 |
add_filter( 'woocommerce_admin_status_tabs', array( $this, 'set_gzd_status_tab' ) );
|
57 |
add_action( 'woocommerce_admin_status_content_germanized', array( $this, 'status_tab' ) );
|
58 |
|
64 |
add_action( 'admin_init', array( $this, 'check_insert_vat_rates' ) );
|
65 |
add_action( 'admin_init', array( $this, 'check_resend_activation_email' ) );
|
66 |
add_action( 'admin_init', array( $this, 'check_notices' ) );
|
67 |
+
|
68 |
add_filter( 'woocommerce_addons_section_data', array( $this, 'set_addon' ), 10, 2 );
|
69 |
add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'set_order_parcel_delivery_opted_in' ), 10, 1 );
|
70 |
|
73 |
|
74 |
add_filter( 'pre_update_option_wp_page_for_privacy_policy', array( $this, 'pre_update_wp_privacy_option_page' ), 10, 2 );
|
75 |
add_filter( 'pre_update_option_woocommerce_data_security_page_id', array( $this, 'pre_update_gzd_privacy_option_page' ), 10, 2 );
|
|
|
76 |
|
77 |
+
add_action( 'woocommerce_admin_field_gzd_toggle', array( $this, 'toggle_input' ), 10 );
|
78 |
+
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'save_toggle_input_field' ), 0, 3 );
|
79 |
+
}
|
80 |
+
|
81 |
+
public function save_toggle_input_field( $value, $option, $raw_value ) {
|
82 |
+
if ( 'gzd_toggle' === $option['type'] ) {
|
83 |
+
$value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
|
84 |
+
}
|
85 |
+
|
86 |
+
return $value;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function toggle_input( $value ) {
|
90 |
+
// Custom attribute handling.
|
91 |
+
$custom_attributes = array();
|
92 |
|
93 |
+
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
|
94 |
+
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
|
95 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
// Description handling.
|
100 |
+
$field_description = WC_Admin_Settings::get_field_description( $value );
|
101 |
+
$description = $field_description['description'];
|
102 |
+
$tooltip_html = $field_description['tooltip_html'];
|
103 |
+
$option_value = WC_Admin_Settings::get_option( $value['id'], $value['default'] );
|
104 |
+
|
105 |
+
?><tr valign="top">
|
106 |
+
<th scope="row" class="titledesc">
|
107 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
|
108 |
+
</th>
|
109 |
+
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
110 |
+
<span id="<?php echo esc_attr( $value['id'] ); ?>-toggle" class="woocommerce-gzd-input-toggle woocommerce-input-toggle woocommerce-input-toggle--<?php echo ( 'yes' === $option_value ? 'enabled' : 'disabled' ); ?>"><?php echo ( 'yes' === $option_value ? __( 'Yes', 'woocommerce-germanized' ) : __( 'No', 'woocommerce-germanized' ) ); ?></span>
|
111 |
+
<input
|
112 |
+
name="<?php echo esc_attr( $value['id'] ); ?>"
|
113 |
+
id="<?php echo esc_attr( $value['id'] ); ?>"
|
114 |
+
type="checkbox"
|
115 |
+
style="display: none; <?php echo esc_attr( $value['css'] ); ?>"
|
116 |
+
value="1"
|
117 |
+
class="<?php echo esc_attr( $value['class'] ); ?>"
|
118 |
+
<?php checked( $option_value, 'yes' ); ?>
|
119 |
+
<?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?>
|
120 |
+
/><?php echo esc_html( $value['suffix'] ); ?> <?php echo $description; // WPCS: XSS ok. ?>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
<?php
|
124 |
+
}
|
125 |
+
|
126 |
+
public function pre_update_gzd_privacy_option_page( $new_value, $old_value ) {
|
127 |
+
if ( apply_filters( 'woocommerce_gzd_sync_wp_privacy_page', true ) ) {
|
128 |
+
remove_filter( 'pre_update_option_wp_page_for_privacy_policy', array( $this, 'pre_update_wp_privacy_option_page' ), 10 );
|
129 |
+
update_option( 'wp_page_for_privacy_policy', $new_value );
|
130 |
+
}
|
131 |
+
|
132 |
+
return $new_value;
|
133 |
+
}
|
134 |
|
135 |
/**
|
136 |
+
* Updates Germanized privacy page option as soon as WP option changes to keep the pages in sync.
|
137 |
+
*
|
138 |
* @param $new_value
|
139 |
* @param $old_value
|
140 |
*/
|
141 |
+
public function pre_update_wp_privacy_option_page( $new_value, $old_value ) {
|
142 |
+
if ( apply_filters( 'woocommerce_gzd_sync_wp_privacy_page', true ) ) {
|
143 |
+
remove_filter( 'pre_update_option_woocommerce_data_security_page_id', array( $this, 'pre_update_gzd_privacy_option_page' ), 10 );
|
144 |
+
update_option( 'woocommerce_data_security_page_id', $new_value );
|
145 |
+
}
|
146 |
|
147 |
+
return $new_value;
|
148 |
+
}
|
149 |
|
150 |
+
public function resend_order_confirmation( $order ) {
|
151 |
|
152 |
+
// Send the customer invoice email.
|
153 |
+
WC()->payment_gateways();
|
154 |
+
WC()->shipping();
|
155 |
|
156 |
+
$mail = WC_germanized()->emails->get_email_instance_by_id( 'customer_processing_order' );
|
157 |
|
158 |
+
if ( $mail ) {
|
159 |
+
$mail->trigger( $order );
|
160 |
|
161 |
+
// Note the event.
|
162 |
+
$order->add_order_note( __( 'Order confirmation manually sent to customer.', 'woocommerce-germanized' ), false, true );
|
163 |
+
do_action( 'woocommerce_gzd_after_resend_order_confirmation_email', $order, 'customer_processing_order' );
|
164 |
+
}
|
165 |
+
}
|
166 |
|
167 |
+
public function order_actions( $actions ) {
|
168 |
+
$actions[ 'order_confirmation' ] = __( 'Resend order confirmation', 'woocommerce-germanized' );
|
169 |
+
return $actions;
|
170 |
+
}
|
171 |
|
172 |
public function status_tab() {
|
173 |
WC_GZD_Admin_Status::output();
|
184 |
return;
|
185 |
|
186 |
?>
|
187 |
+
<p><strong style="display: block;"><?php _e( 'Parcel Delivery Data Transfer:', 'woocommerce-germanized' ) ?></strong>
|
188 |
+
<span><?php echo ( wc_gzd_order_supports_parcel_delivery_reminder( wc_gzd_get_crud_data( $order, 'id' ) ) ? __( 'allowed', 'woocommerce-germanized' ) : __( 'not allowed', 'woocommerce-germanized' ) ); ?></span>
|
189 |
+
</p>
|
190 |
+
<?php
|
191 |
}
|
192 |
|
193 |
public function set_addon( $products, $section_id ) {
|
229 |
wp_register_script( 'wc-gzd-admin-legal-checkboxes', $admin_script_path . 'legal-checkboxes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select' ), WC_GERMANIZED_VERSION );
|
230 |
|
231 |
if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] == 'germanized' ) {
|
232 |
+
|
233 |
wp_enqueue_script( 'wc-gzd-admin' );
|
234 |
|
235 |
$section = 'general';
|
241 |
do_action( 'woocommerce_gzd_load_trusted_shops_script' );
|
242 |
|
243 |
if ( $this->is_tour_enabled( $section ) ) {
|
244 |
+
|
245 |
wp_enqueue_script( 'scrollto' );
|
246 |
wp_enqueue_script( 'tourbus' );
|
247 |
wp_enqueue_script( 'wc-gzd-admin-tour' );
|
261 |
}
|
262 |
|
263 |
public function localize_printed_scripts() {
|
264 |
+
$localized_scripts = apply_filters( 'woocommerce_gzd_admin_localized_scripts', array() );
|
265 |
|
266 |
+
foreach( $localized_scripts as $handle => $data ) {
|
267 |
+
if ( ! in_array( $handle, self::$wp_localize_scripts ) && wp_script_is( $handle ) ) {
|
268 |
+
$name = str_replace( '-', '_', $handle ) . '_params';
|
269 |
+
self::$wp_localize_scripts[] = $handle;
|
270 |
+
wp_localize_script( $handle, $name, $data );
|
271 |
+
}
|
272 |
+
}
|
273 |
+
}
|
274 |
|
275 |
public function add_legal_page_metabox() {
|
276 |
add_meta_box( 'wc-gzd-legal-page-email-content', __( 'Optional Email Content', 'woocommerce-germanized' ), array( $this, 'init_legal_page_metabox' ), 'page' );
|
288 |
|
289 |
public function add_product_mini_desc() {
|
290 |
global $post;
|
291 |
+
|
292 |
if ( is_object( $post ) && $post->post_type === 'product' ) {
|
293 |
$product = wc_get_product( $post );
|
294 |
if ( ! $product->is_type( 'variable' ) )
|
305 |
update_post_meta( $post_id, '_legal_text', wc_gzd_sanitize_html_text_field( $_POST[ '_legal_text' ] ) );
|
306 |
else
|
307 |
delete_post_meta( $post_id, '_legal_text' );
|
308 |
+
|
309 |
}
|
310 |
|
311 |
public function init_product_mini_desc( $post ) {
|
323 |
|
324 |
public function check_tour_hide() {
|
325 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'tour' ] ) && isset( $_GET[ 'hide' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-tour-hide' ) ) {
|
326 |
+
|
327 |
if ( ! empty( $_GET[ 'tour' ] ) )
|
328 |
update_option( 'woocommerce_gzd_hide_tour_' . sanitize_text_field( $_GET[ 'tour' ] ), true );
|
329 |
+
else
|
330 |
update_option( 'woocommerce_gzd_hide_tour', true );
|
331 |
+
|
332 |
wp_safe_redirect( remove_query_arg( array( 'hide', 'tour', '_wpnonce' ) ) );
|
333 |
+
|
334 |
} elseif ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'tour' ] ) && isset( $_GET[ 'enable' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-tour-enable' ) ) {
|
335 |
+
|
336 |
+
$setting_sections = array_merge( array(
|
337 |
'general' => '',
|
338 |
'display' => '',
|
339 |
'checkboxes' => '',
|
340 |
'email' => ''
|
341 |
+
), apply_filters( 'woocommerce_gzd_settings_sections', array() ) );
|
342 |
+
|
343 |
delete_option( 'woocommerce_gzd_hide_tour' );
|
344 |
+
|
345 |
foreach ( $setting_sections as $section => $name )
|
346 |
delete_option( 'woocommerce_gzd_hide_tour_' . $section );
|
347 |
}
|
348 |
+
}
|
349 |
|
350 |
+
public function check_language_install() {
|
351 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'install-language' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-install-language' ) ) {
|
352 |
+
|
353 |
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
|
354 |
$language = sanitize_text_field( $_GET[ 'install-language' ] );
|
355 |
|
380 |
|
381 |
$checkboxes = $manager->get_checkboxes();
|
382 |
$text_options = array(
|
383 |
+
'label',
|
384 |
+
'error_message',
|
385 |
+
'confirmation',
|
386 |
+
'admin_desc',
|
387 |
+
'admin_name',
|
388 |
+
);
|
389 |
|
390 |
foreach( $checkboxes as $checkbox ) {
|
391 |
+
if ( ! $checkbox->is_core() ) {
|
392 |
+
continue;
|
393 |
+
}
|
394 |
+
foreach( $text_options as $text_option ) {
|
395 |
+
if ( isset( $options[ $checkbox->get_id() ][ $text_option ] ) ) {
|
396 |
+
unset( $options[ $checkbox->get_id() ][ $text_option ] );
|
397 |
+
}
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
$manager->update_options( $options );
|
402 |
|
403 |
// Reinstall options
|
404 |
WC_GZD_Install::create_options();
|
415 |
|
416 |
wc_gzd_get_dependencies()->delete_cached_plugin_header_data();
|
417 |
|
418 |
+
do_action( 'woocommerce_gzd_deleted_cached_plugin_header_data' );
|
419 |
}
|
420 |
}
|
421 |
|
422 |
public function get_complaints_shortcode_pages() {
|
423 |
|
424 |
+
$pages = array(
|
425 |
+
'imprint' => wc_get_page_id( 'imprint' ),
|
426 |
+
);
|
427 |
|
428 |
+
if ( wc_get_page_id( 'terms' ) && wc_get_page_id( 'terms' ) != -1 ) {
|
429 |
+
$pages[ 'terms' ] = wc_get_page_id( 'terms' );
|
430 |
+
}
|
431 |
|
432 |
+
return $pages;
|
433 |
+
}
|
434 |
|
435 |
+
public function check_resend_activation_email() {
|
436 |
+
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET['user_id'] ) && isset( $_GET['gzd-resend-activation'] ) && 'yes' === $_GET['gzd-resend-activation'] && isset( $_GET['_wpnonce'] ) && check_admin_referer( 'resend-activation-link' ) ) {
|
437 |
+
$user_id = absint( $_GET['user_id'] );
|
438 |
|
439 |
+
if ( ! empty( $user_id ) && ! wc_gzd_is_customer_activated( $user_id ) ) {
|
440 |
+
$helper = WC_GZD_Customer_Helper::instance();
|
441 |
+
$user_activation = $helper->get_customer_activation_meta( $user_id, true );
|
442 |
+
$user_activation_url = $helper->get_customer_activation_url( $user_activation );
|
443 |
|
444 |
+
if ( $email = WC_germanized()->emails->get_email_instance_by_id( 'customer_new_account_activation' ) )
|
445 |
+
$email->trigger( $user_id, $user_activation, $user_activation_url );
|
446 |
+
}
|
447 |
|
448 |
+
// Redirect to check for updates
|
449 |
+
wp_safe_redirect( admin_url( sprintf( 'user-edit.php?user_id=%d&gzd-sent=yes', $user_id ) ) );
|
450 |
+
}
|
451 |
+
}
|
452 |
|
453 |
public function check_complaints_shortcode_append() {
|
454 |
+
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'complaints' ] ) && 'add' === $_GET[ 'complaints' ] && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'append-complaints-shortcode' ) ) {
|
455 |
+
|
456 |
+
$pages = $this->get_complaints_shortcode_pages();
|
457 |
+
|
458 |
+
foreach( $pages as $page_name => $page_id ) {
|
459 |
+
|
460 |
+
if ( $page_id != 1 ) {
|
461 |
+
$this->insert_complaints_shortcode( $page_id );
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
// Redirect to check for updates
|
466 |
+
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=germanized' ) );
|
467 |
+
}
|
468 |
+
}
|
469 |
+
|
470 |
+
public function is_complaints_shortcode_inserted( $page_id ) {
|
471 |
+
$post = get_post( $page_id );
|
472 |
+
if ( $post )
|
473 |
+
return ( strpos( $post->post_content, '[gzd_complaints]' ) !== false ? true : false );
|
474 |
+
return false;
|
475 |
+
}
|
476 |
+
|
477 |
+
public function insert_complaints_shortcode( $page_id ) {
|
478 |
+
if ( $this->is_complaints_shortcode_inserted( $page_id ) )
|
479 |
+
return;
|
480 |
+
|
481 |
+
$page = get_post( $page_id );
|
482 |
+
wp_update_post(
|
483 |
+
array(
|
484 |
+
'ID' => $page_id,
|
485 |
+
'post_content' => $page->post_content . "\n[gzd_complaints]",
|
486 |
+
)
|
487 |
+
);
|
488 |
+
}
|
489 |
|
490 |
public function check_notices() {
|
491 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'check-notices' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-notices' ) ) {
|
492 |
|
493 |
+
if ( get_option( 'woocommerce_gzd_disable_notices' ) ) {
|
494 |
+
delete_option( 'woocommerce_gzd_disable_notices' );
|
495 |
+
} else {
|
496 |
+
update_option( 'woocommerce_gzd_disable_notices', 'yes' );
|
497 |
+
}
|
498 |
|
499 |
// Redirect to check for updates
|
500 |
wp_safe_redirect( admin_url( 'admin.php?page=wc-status&tab=germanized' ) );
|
504 |
public function check_insert_vat_rates() {
|
505 |
if ( current_user_can( 'manage_woocommerce' ) && isset( $_GET[ 'insert-vat-rates' ] ) && isset( $_GET[ '_wpnonce' ] ) && check_admin_referer( 'wc-gzd-insert-vat-rates' ) ) {
|
506 |
|
507 |
+
WC_GZD_Install::create_tax_rates();
|
508 |
WC_GZD_Install::create_virtual_tax_rates();
|
509 |
|
510 |
// Redirect to check for updates
|
512 |
}
|
513 |
}
|
514 |
|
515 |
+
public function get_shipping_method_instances() {
|
516 |
+
// Make sure we are not firing before init because otherwise some Woo errors might occur
|
517 |
+
if ( ! did_action( 'init' ) ) {
|
518 |
+
return array();
|
519 |
+
}
|
520 |
|
521 |
+
if ( ! class_exists( 'WC_Shipping_Zones' ) ) {
|
522 |
+
$instances = WC()->shipping->get_shipping_methods();
|
523 |
+
} else {
|
524 |
+
$zones = WC_Shipping_Zones::get_zones();
|
525 |
+
$worldwide = new WC_Shipping_Zone( 0 );
|
526 |
|
527 |
+
$instances = $worldwide->get_shipping_methods( true );
|
528 |
|
529 |
+
foreach( $zones as $id => $zone ) {
|
530 |
+
$zone = new WC_Shipping_Zone( $id );
|
531 |
+
$instances = $instances + $zone->get_shipping_methods( true );
|
532 |
+
}
|
533 |
+
}
|
534 |
|
535 |
+
return $instances;
|
536 |
+
}
|
537 |
|
538 |
+
public function get_shipping_method_instances_options() {
|
539 |
|
540 |
+
$methods = $this->get_shipping_method_instances();
|
541 |
+
$shipping_methods_options = array();
|
542 |
|
543 |
+
foreach ( $methods as $key => $method ) {
|
544 |
|
545 |
+
if ( method_exists( $method, 'get_rate_id' ) ) {
|
546 |
+
$key = $method->get_rate_id();
|
547 |
+
} else {
|
548 |
+
$key = $method->id;
|
549 |
+
}
|
550 |
|
551 |
+
$title = $method->get_title();
|
552 |
|
553 |
+
$shipping_methods_options[ $key ] = ( empty( $title ) ? $method->get_method_title() : $title );
|
554 |
+
}
|
555 |
|
556 |
+
return $shipping_methods_options;
|
557 |
+
}
|
558 |
|
559 |
+
public function get_payment_gateway_options() {
|
560 |
+
$gateways = WC()->payment_gateways->payment_gateways();
|
561 |
+
$options = array();
|
562 |
|
563 |
+
if ( ! empty( $gateways ) ) {
|
564 |
+
foreach( $gateways as $gateway ) {
|
565 |
+
$options[ $gateway->id ] = $gateway->title;
|
566 |
+
}
|
567 |
+
}
|
568 |
|
569 |
+
return $options;
|
570 |
+
}
|
571 |
|
572 |
private function get_setting_key_by_id( $settings, $id, $type = '' ) {
|
573 |
if ( ! empty( $settings ) ) {
|
599 |
}
|
600 |
|
601 |
public function insert_setting_after( $settings, $id, $insert = array(), $type = '' ) {
|
602 |
+
$key = $this->get_setting_key_by_id( $settings, $id, $type );
|
603 |
if ( is_numeric( $key ) ) {
|
604 |
$key++;
|
605 |
$settings = array_merge( array_merge( array_slice( $settings, 0, $key, true ), $insert ), array_slice( $settings, $key, count( $settings ) - 1, true ) );
|
includes/class-wc-gzd-checkout.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
class WC_GZD_Checkout {
|
4 |
|
5 |
-
public $custom_fields
|
6 |
public $custom_fields_admin = array();
|
7 |
|
8 |
protected static $force_free_shipping_filter = false;
|
@@ -35,18 +35,18 @@ class WC_GZD_Checkout {
|
|
35 |
}
|
36 |
|
37 |
public function __construct() {
|
38 |
-
|
39 |
add_action( 'init', array( $this, 'init_fields' ), 30 );
|
40 |
add_filter( 'woocommerce_billing_fields', array( $this, 'set_custom_fields' ), 0, 1 );
|
41 |
add_filter( 'woocommerce_shipping_fields', array( $this, 'set_custom_fields_shipping' ), 0, 1 );
|
42 |
-
|
43 |
// Add Fields to Order Edit Page
|
44 |
add_filter( 'woocommerce_admin_billing_fields', array( $this, 'set_custom_fields_admin_billing' ), 0, 1 );
|
45 |
add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'set_custom_fields_admin_shipping' ), 0, 1 );
|
46 |
-
|
47 |
// Save Fields on order
|
48 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_fields' ) );
|
49 |
-
|
50 |
// Add Title to billing address format
|
51 |
add_filter( 'woocommerce_order_formatted_billing_address', array( $this, 'set_formatted_billing_address' ), 0, 2 );
|
52 |
add_filter( 'woocommerce_order_formatted_shipping_address', array( $this, 'set_formatted_shipping_address' ), 0, 2 );
|
@@ -63,15 +63,15 @@ class WC_GZD_Checkout {
|
|
63 |
}
|
64 |
|
65 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'set_order_meta_hidden' ), 0 );
|
66 |
-
|
67 |
// Deactivate checkout shipping selection
|
68 |
add_action( 'woocommerce_review_order_before_shipping', array( $this, 'remove_shipping_rates' ), 0 );
|
69 |
-
|
70 |
// Add better fee taxation
|
71 |
add_action( 'woocommerce_calculate_totals', array( $this, 'do_fee_tax_calculation' ), PHP_INT_MAX, 1 );
|
72 |
// Pre WC 3.2
|
73 |
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'do_fee_tax_calculation_legacy' ), PHP_INT_MAX, 1 );
|
74 |
-
|
75 |
// Disallow user order cancellation
|
76 |
if ( get_option( 'woocommerce_gzd_checkout_stop_order_cancellation' ) == 'yes' ) {
|
77 |
add_filter( 'woocommerce_get_cancel_order_url', array( $this, 'cancel_order_url' ), PHP_INT_MAX, 1 );
|
@@ -86,7 +86,7 @@ class WC_GZD_Checkout {
|
|
86 |
add_action( 'woocommerce_reduce_order_stock', array( $this, 'set_order_stock_reduced_meta' ), 10, 1 );
|
87 |
add_filter( 'woocommerce_can_reduce_order_stock', array( $this, 'maybe_disallow_order_stock_reducing' ), 10, 2 );
|
88 |
}
|
89 |
-
|
90 |
// Free Shipping auto select
|
91 |
if ( get_option( 'woocommerce_gzd_display_checkout_free_shipping_select' ) == 'yes' ) {
|
92 |
add_filter( 'woocommerce_package_rates', array( $this, 'free_shipping_auto_select' ) );
|
@@ -103,7 +103,8 @@ class WC_GZD_Checkout {
|
|
103 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'order_parcel_delivery_data_transfer' ), 10, 2 );
|
104 |
|
105 |
// Make sure that, just like in Woo core, the order submit button gets refreshed
|
106 |
-
|
|
|
107 |
}
|
108 |
|
109 |
public function refresh_order_submit( $fragments ) {
|
@@ -168,7 +169,7 @@ class WC_GZD_Checkout {
|
|
168 |
global $wp;
|
169 |
|
170 |
if ( is_wc_endpoint_url( 'order-pay' ) && isset( $_GET[ 'force_pay_order' ] ) ) {
|
171 |
-
|
172 |
// Manipulate $_POST
|
173 |
$order_key = $_GET['key'];
|
174 |
$order_id = absint( $wp->query_vars[ 'order-pay' ] );
|
@@ -250,9 +251,9 @@ class WC_GZD_Checkout {
|
|
250 |
if ( isset( WC()->session ) && ! is_null( WC()->session ) ) {
|
251 |
unset( WC()->session->chosen_shipping_methods );
|
252 |
}
|
253 |
-
|
254 |
foreach ( $rates as $key => $rate ) {
|
255 |
-
|
256 |
if ( ! in_array( $key, $keep ) )
|
257 |
unset( $rates[ $key ] );
|
258 |
}
|
@@ -268,9 +269,9 @@ class WC_GZD_Checkout {
|
|
268 |
if ( get_option( 'woocommerce_gzd_order_pay_now_button' ) === 'no' ) {
|
269 |
$enabled = false;
|
270 |
}
|
271 |
-
|
272 |
$order = wc_get_order( $order_id );
|
273 |
-
|
274 |
if ( ! $order->needs_payment() ) {
|
275 |
$enabled = false;
|
276 |
}
|
@@ -333,26 +334,26 @@ class WC_GZD_Checkout {
|
|
333 |
switch ( $caps[0] ) {
|
334 |
case 'cancel_order' :
|
335 |
$allcaps['cancel_order'] = false;
|
336 |
-
|
337 |
}
|
338 |
}
|
339 |
return $allcaps;
|
340 |
}
|
341 |
|
342 |
public function cancel_order_url( $url ) {
|
343 |
-
|
344 |
// Default to home url
|
345 |
$return = get_permalink( wc_get_page_id( 'shop' ) );
|
346 |
|
347 |
// Extract order id and use order success page as return url
|
348 |
$search = preg_match( '/order_id=([0-9]+)/', $url, $matches );
|
349 |
-
|
350 |
if ( $search && isset( $matches[1] ) ) {
|
351 |
$order_id = absint( $matches[1] );
|
352 |
$order = wc_get_order( $order_id );
|
353 |
$return = apply_filters( 'woocommerce_gzd_attempt_order_cancellation_url', add_query_arg( array( 'retry' => true ), $order->get_checkout_order_received_url(), $order ) );
|
354 |
}
|
355 |
-
|
356 |
return $return;
|
357 |
}
|
358 |
|
@@ -408,35 +409,41 @@ class WC_GZD_Checkout {
|
|
408 |
|
409 |
/**
|
410 |
* Recalculate fee taxes to split tax based on different tax rates contained within cart
|
411 |
-
*
|
412 |
* @param WC_Cart $cart
|
413 |
*/
|
414 |
public function do_fee_tax_calculation( $cart ) {
|
415 |
|
416 |
-
if ( get_option( 'woocommerce_gzd_fee_tax' )
|
417 |
return;
|
418 |
|
419 |
if ( ! method_exists( $cart, 'set_fee_taxes' ) )
|
420 |
return;
|
421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
$fees = $cart->get_fees();
|
423 |
|
424 |
if ( ! empty( $fees ) ) {
|
425 |
|
426 |
-
$tax_shares
|
427 |
$fee_tax_total = 0;
|
428 |
-
$fee_tax_data
|
429 |
-
$new_fees
|
430 |
|
431 |
foreach ( $cart->get_fees() as $key => $fee ) {
|
432 |
|
433 |
-
if ( ! $fee->taxable && get_option( 'woocommerce_gzd_fee_tax_force' )
|
434 |
continue;
|
435 |
|
436 |
// Calculate gross price if necessary
|
437 |
if ( $fee->taxable ) {
|
438 |
$fee_tax_rates = WC_Tax::get_rates( $fee->tax_class );
|
439 |
-
$fee_tax
|
440 |
$fee->amount += array_sum( $fee_tax );
|
441 |
}
|
442 |
|
@@ -448,18 +455,19 @@ class WC_GZD_Checkout {
|
|
448 |
$fee_taxes = array();
|
449 |
|
450 |
foreach ( $tax_shares as $rate => $class ) {
|
451 |
-
$tax_rates
|
452 |
-
$tax_shares[ $rate ][
|
453 |
-
$tax_shares[ $rate ][
|
454 |
-
|
|
|
455 |
}
|
456 |
|
457 |
foreach ( $tax_shares as $rate => $class ) {
|
458 |
-
|
459 |
foreach ( $class['fee_tax'] as $rate_id => $tax ) {
|
460 |
if ( ! array_key_exists( $rate_id, $fee_tax_data ) ) {
|
461 |
$fee_tax_data[ $rate_id ] = 0;
|
462 |
}
|
|
|
463 |
$fee_tax_data[ $rate_id ] += $tax;
|
464 |
}
|
465 |
|
@@ -467,9 +475,9 @@ class WC_GZD_Checkout {
|
|
467 |
}
|
468 |
|
469 |
$fee->tax_data = $fee_taxes;
|
470 |
-
$fee->tax
|
471 |
-
$fee->amount
|
472 |
-
$fee->total
|
473 |
|
474 |
$new_fees[ $key ] = $fee;
|
475 |
}
|
@@ -489,6 +497,12 @@ class WC_GZD_Checkout {
|
|
489 |
if ( method_exists( $cart, 'set_fee_taxes' ) )
|
490 |
return;
|
491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
if ( ! empty( $cart->fees ) ) {
|
493 |
$tax_shares = wc_gzd_get_cart_tax_share( 'fee' );
|
494 |
foreach ( $cart->fees as $key => $fee ) {
|
@@ -499,7 +513,8 @@ class WC_GZD_Checkout {
|
|
499 |
// Calculate gross price if necessary
|
500 |
if ( $fee->taxable ) {
|
501 |
$fee_tax_rates = WC_Tax::get_rates( $fee->tax_class );
|
502 |
-
$fee_tax
|
|
|
503 |
$fee->amount += array_sum( $fee_tax );
|
504 |
}
|
505 |
|
@@ -510,13 +525,14 @@ class WC_GZD_Checkout {
|
|
510 |
if ( ! empty( $tax_shares ) ) {
|
511 |
$fee_taxes = array();
|
512 |
foreach ( $tax_shares as $rate => $class ) {
|
513 |
-
$tax_rates
|
514 |
-
$tax_shares[ $rate ][
|
515 |
-
$tax_shares[ $rate ][
|
516 |
-
|
|
|
517 |
}
|
518 |
foreach ( $tax_shares as $rate => $class ) {
|
519 |
-
$cart->fees[ $key ]->tax_data = $cart->fees[ $key ]->tax_data + $class[
|
520 |
}
|
521 |
// Add fee taxes to cart taxes
|
522 |
foreach ( array_keys( $cart->taxes + $fee_taxes ) as $sub ) {
|
@@ -531,35 +547,35 @@ class WC_GZD_Checkout {
|
|
531 |
}
|
532 |
|
533 |
/**
|
534 |
-
* Temporarily removes all shipping rates (except chosen one) from packages to only show chosen package within checkout.
|
535 |
*/
|
536 |
public function remove_shipping_rates() {
|
537 |
-
if ( get_option( 'woocommerce_gzd_display_checkout_shipping_rate_select' )
|
538 |
return;
|
539 |
-
|
540 |
$packages = WC()->shipping->get_packages();
|
541 |
-
|
542 |
foreach ( $packages as $i => $package ) {
|
543 |
-
|
544 |
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
|
545 |
-
|
546 |
-
if ( ! empty( $package[
|
547 |
-
foreach ( $package[
|
548 |
if ( $key != $chosen_method )
|
549 |
-
unset( WC()->shipping->packages[ $i ][
|
550 |
}
|
551 |
-
}
|
552 |
}
|
553 |
}
|
554 |
|
555 |
/**
|
556 |
* Adds product description to order meta
|
557 |
-
*
|
558 |
-
* @param int $order_id
|
559 |
-
* @param int $item_id
|
560 |
-
* @param object $product
|
561 |
-
* @param int $qty
|
562 |
-
* @param array $args
|
563 |
*/
|
564 |
public function set_order_meta( $order_id, $item_id, $product, $qty, $args ) {
|
565 |
wc_add_order_item_meta( $item_id, '_units', wc_gzd_get_gzd_product( $product )->get_product_units_html() );
|
@@ -585,7 +601,7 @@ class WC_GZD_Checkout {
|
|
585 |
|
586 |
/**
|
587 |
* Hide product description from order meta default output
|
588 |
-
*
|
589 |
* @param array $metas
|
590 |
*/
|
591 |
public function set_order_meta_hidden( $metas ) {
|
2 |
|
3 |
class WC_GZD_Checkout {
|
4 |
|
5 |
+
public $custom_fields = array();
|
6 |
public $custom_fields_admin = array();
|
7 |
|
8 |
protected static $force_free_shipping_filter = false;
|
35 |
}
|
36 |
|
37 |
public function __construct() {
|
38 |
+
|
39 |
add_action( 'init', array( $this, 'init_fields' ), 30 );
|
40 |
add_filter( 'woocommerce_billing_fields', array( $this, 'set_custom_fields' ), 0, 1 );
|
41 |
add_filter( 'woocommerce_shipping_fields', array( $this, 'set_custom_fields_shipping' ), 0, 1 );
|
42 |
+
|
43 |
// Add Fields to Order Edit Page
|
44 |
add_filter( 'woocommerce_admin_billing_fields', array( $this, 'set_custom_fields_admin_billing' ), 0, 1 );
|
45 |
add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'set_custom_fields_admin_shipping' ), 0, 1 );
|
46 |
+
|
47 |
// Save Fields on order
|
48 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_fields' ) );
|
49 |
+
|
50 |
// Add Title to billing address format
|
51 |
add_filter( 'woocommerce_order_formatted_billing_address', array( $this, 'set_formatted_billing_address' ), 0, 2 );
|
52 |
add_filter( 'woocommerce_order_formatted_shipping_address', array( $this, 'set_formatted_shipping_address' ), 0, 2 );
|
63 |
}
|
64 |
|
65 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'set_order_meta_hidden' ), 0 );
|
66 |
+
|
67 |
// Deactivate checkout shipping selection
|
68 |
add_action( 'woocommerce_review_order_before_shipping', array( $this, 'remove_shipping_rates' ), 0 );
|
69 |
+
|
70 |
// Add better fee taxation
|
71 |
add_action( 'woocommerce_calculate_totals', array( $this, 'do_fee_tax_calculation' ), PHP_INT_MAX, 1 );
|
72 |
// Pre WC 3.2
|
73 |
add_action( 'woocommerce_cart_calculate_fees', array( $this, 'do_fee_tax_calculation_legacy' ), PHP_INT_MAX, 1 );
|
74 |
+
|
75 |
// Disallow user order cancellation
|
76 |
if ( get_option( 'woocommerce_gzd_checkout_stop_order_cancellation' ) == 'yes' ) {
|
77 |
add_filter( 'woocommerce_get_cancel_order_url', array( $this, 'cancel_order_url' ), PHP_INT_MAX, 1 );
|
86 |
add_action( 'woocommerce_reduce_order_stock', array( $this, 'set_order_stock_reduced_meta' ), 10, 1 );
|
87 |
add_filter( 'woocommerce_can_reduce_order_stock', array( $this, 'maybe_disallow_order_stock_reducing' ), 10, 2 );
|
88 |
}
|
89 |
+
|
90 |
// Free Shipping auto select
|
91 |
if ( get_option( 'woocommerce_gzd_display_checkout_free_shipping_select' ) == 'yes' ) {
|
92 |
add_filter( 'woocommerce_package_rates', array( $this, 'free_shipping_auto_select' ) );
|
103 |
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'order_parcel_delivery_data_transfer' ), 10, 2 );
|
104 |
|
105 |
// Make sure that, just like in Woo core, the order submit button gets refreshed
|
106 |
+
// Use a high priority to let other plugins do their adjustments beforehand
|
107 |
+
add_filter( 'woocommerce_update_order_review_fragments', array( $this, 'refresh_order_submit' ), 150, 1 );
|
108 |
}
|
109 |
|
110 |
public function refresh_order_submit( $fragments ) {
|
169 |
global $wp;
|
170 |
|
171 |
if ( is_wc_endpoint_url( 'order-pay' ) && isset( $_GET[ 'force_pay_order' ] ) ) {
|
172 |
+
|
173 |
// Manipulate $_POST
|
174 |
$order_key = $_GET['key'];
|
175 |
$order_id = absint( $wp->query_vars[ 'order-pay' ] );
|
251 |
if ( isset( WC()->session ) && ! is_null( WC()->session ) ) {
|
252 |
unset( WC()->session->chosen_shipping_methods );
|
253 |
}
|
254 |
+
|
255 |
foreach ( $rates as $key => $rate ) {
|
256 |
+
|
257 |
if ( ! in_array( $key, $keep ) )
|
258 |
unset( $rates[ $key ] );
|
259 |
}
|
269 |
if ( get_option( 'woocommerce_gzd_order_pay_now_button' ) === 'no' ) {
|
270 |
$enabled = false;
|
271 |
}
|
272 |
+
|
273 |
$order = wc_get_order( $order_id );
|
274 |
+
|
275 |
if ( ! $order->needs_payment() ) {
|
276 |
$enabled = false;
|
277 |
}
|
334 |
switch ( $caps[0] ) {
|
335 |
case 'cancel_order' :
|
336 |
$allcaps['cancel_order'] = false;
|
337 |
+
break;
|
338 |
}
|
339 |
}
|
340 |
return $allcaps;
|
341 |
}
|
342 |
|
343 |
public function cancel_order_url( $url ) {
|
344 |
+
|
345 |
// Default to home url
|
346 |
$return = get_permalink( wc_get_page_id( 'shop' ) );
|
347 |
|
348 |
// Extract order id and use order success page as return url
|
349 |
$search = preg_match( '/order_id=([0-9]+)/', $url, $matches );
|
350 |
+
|
351 |
if ( $search && isset( $matches[1] ) ) {
|
352 |
$order_id = absint( $matches[1] );
|
353 |
$order = wc_get_order( $order_id );
|
354 |
$return = apply_filters( 'woocommerce_gzd_attempt_order_cancellation_url', add_query_arg( array( 'retry' => true ), $order->get_checkout_order_received_url(), $order ) );
|
355 |
}
|
356 |
+
|
357 |
return $return;
|
358 |
}
|
359 |
|
409 |
|
410 |
/**
|
411 |
* Recalculate fee taxes to split tax based on different tax rates contained within cart
|
412 |
+
*
|
413 |
* @param WC_Cart $cart
|
414 |
*/
|
415 |
public function do_fee_tax_calculation( $cart ) {
|
416 |
|
417 |
+
if ( 'yes' !== get_option( 'woocommerce_gzd_fee_tax' ) )
|
418 |
return;
|
419 |
|
420 |
if ( ! method_exists( $cart, 'set_fee_taxes' ) )
|
421 |
return;
|
422 |
|
423 |
+
$calculate_taxes = wc_tax_enabled() && ! WC()->customer->is_vat_exempt();
|
424 |
+
|
425 |
+
// Do not calculate tax shares if tax calculation is disabled
|
426 |
+
if ( ! $calculate_taxes )
|
427 |
+
return;
|
428 |
+
|
429 |
$fees = $cart->get_fees();
|
430 |
|
431 |
if ( ! empty( $fees ) ) {
|
432 |
|
433 |
+
$tax_shares = wc_gzd_get_cart_tax_share( 'fee' );
|
434 |
$fee_tax_total = 0;
|
435 |
+
$fee_tax_data = array();
|
436 |
+
$new_fees = array();
|
437 |
|
438 |
foreach ( $cart->get_fees() as $key => $fee ) {
|
439 |
|
440 |
+
if ( ! $fee->taxable && 'yes' !== get_option( 'woocommerce_gzd_fee_tax_force' ) )
|
441 |
continue;
|
442 |
|
443 |
// Calculate gross price if necessary
|
444 |
if ( $fee->taxable ) {
|
445 |
$fee_tax_rates = WC_Tax::get_rates( $fee->tax_class );
|
446 |
+
$fee_tax = WC_Tax::calc_tax( $fee->amount, $fee_tax_rates, false );
|
447 |
$fee->amount += array_sum( $fee_tax );
|
448 |
}
|
449 |
|
455 |
$fee_taxes = array();
|
456 |
|
457 |
foreach ( $tax_shares as $rate => $class ) {
|
458 |
+
$tax_rates = WC_Tax::get_rates( $rate );
|
459 |
+
$tax_shares[ $rate ]['fee_tax_share'] = $fee->amount * $class['share'];
|
460 |
+
$tax_shares[ $rate ]['fee_tax'] = WC_Tax::calc_tax( ( $fee->amount * $class['share'] ), $tax_rates, true );
|
461 |
+
|
462 |
+
$fee_taxes += $tax_shares[ $rate ]['fee_tax'];
|
463 |
}
|
464 |
|
465 |
foreach ( $tax_shares as $rate => $class ) {
|
|
|
466 |
foreach ( $class['fee_tax'] as $rate_id => $tax ) {
|
467 |
if ( ! array_key_exists( $rate_id, $fee_tax_data ) ) {
|
468 |
$fee_tax_data[ $rate_id ] = 0;
|
469 |
}
|
470 |
+
|
471 |
$fee_tax_data[ $rate_id ] += $tax;
|
472 |
}
|
473 |
|
475 |
}
|
476 |
|
477 |
$fee->tax_data = $fee_taxes;
|
478 |
+
$fee->tax = $fee_tax_total;
|
479 |
+
$fee->amount = $fee->amount - $fee->tax;
|
480 |
+
$fee->total = $fee->amount;
|
481 |
|
482 |
$new_fees[ $key ] = $fee;
|
483 |
}
|
497 |
if ( method_exists( $cart, 'set_fee_taxes' ) )
|
498 |
return;
|
499 |
|
500 |
+
$calculate_taxes = wc_tax_enabled() && ! WC()->customer->is_vat_exempt();
|
501 |
+
|
502 |
+
// Do not calculate tax shares if tax calculation is disabled
|
503 |
+
if ( ! $calculate_taxes )
|
504 |
+
return;
|
505 |
+
|
506 |
if ( ! empty( $cart->fees ) ) {
|
507 |
$tax_shares = wc_gzd_get_cart_tax_share( 'fee' );
|
508 |
foreach ( $cart->fees as $key => $fee ) {
|
513 |
// Calculate gross price if necessary
|
514 |
if ( $fee->taxable ) {
|
515 |
$fee_tax_rates = WC_Tax::get_rates( $fee->tax_class );
|
516 |
+
$fee_tax = WC_Tax::calc_tax( $fee->amount, $fee_tax_rates, false );
|
517 |
+
|
518 |
$fee->amount += array_sum( $fee_tax );
|
519 |
}
|
520 |
|
525 |
if ( ! empty( $tax_shares ) ) {
|
526 |
$fee_taxes = array();
|
527 |
foreach ( $tax_shares as $rate => $class ) {
|
528 |
+
$tax_rates = WC_Tax::get_rates( $rate );
|
529 |
+
$tax_shares[ $rate ]['fee_tax_share'] = $fee->amount * $class['share'];
|
530 |
+
$tax_shares[ $rate ]['fee_tax'] = WC_Tax::calc_tax( ( $fee->amount * $class['share'] ), $tax_rates, true );
|
531 |
+
|
532 |
+
$fee_taxes += $tax_shares[ $rate ]['fee_tax'];
|
533 |
}
|
534 |
foreach ( $tax_shares as $rate => $class ) {
|
535 |
+
$cart->fees[ $key ]->tax_data = $cart->fees[ $key ]->tax_data + $class['fee_tax'];
|
536 |
}
|
537 |
// Add fee taxes to cart taxes
|
538 |
foreach ( array_keys( $cart->taxes + $fee_taxes ) as $sub ) {
|
547 |
}
|
548 |
|
549 |
/**
|
550 |
+
* Temporarily removes all shipping rates (except chosen one) from packages to only show chosen package within checkout.
|
551 |
*/
|
552 |
public function remove_shipping_rates() {
|
553 |
+
if ( 'no' === get_option( 'woocommerce_gzd_display_checkout_shipping_rate_select' ) )
|
554 |
return;
|
555 |
+
|
556 |
$packages = WC()->shipping->get_packages();
|
557 |
+
|
558 |
foreach ( $packages as $i => $package ) {
|
559 |
+
|
560 |
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
|
561 |
+
|
562 |
+
if ( ! empty( $package['rates'] ) ) {
|
563 |
+
foreach ( $package['rates'] as $key => $rate ) {
|
564 |
if ( $key != $chosen_method )
|
565 |
+
unset( WC()->shipping->packages[ $i ]['rates'][ $key ] );
|
566 |
}
|
567 |
+
}
|
568 |
}
|
569 |
}
|
570 |
|
571 |
/**
|
572 |
* Adds product description to order meta
|
573 |
+
*
|
574 |
+
* @param int $order_id
|
575 |
+
* @param int $item_id
|
576 |
+
* @param object $product
|
577 |
+
* @param int $qty
|
578 |
+
* @param array $args
|
579 |
*/
|
580 |
public function set_order_meta( $order_id, $item_id, $product, $qty, $args ) {
|
581 |
wc_add_order_item_meta( $item_id, '_units', wc_gzd_get_gzd_product( $product )->get_product_units_html() );
|
601 |
|
602 |
/**
|
603 |
* Hide product description from order meta default output
|
604 |
+
*
|
605 |
* @param array $metas
|
606 |
*/
|
607 |
public function set_order_meta_hidden( $metas ) {
|
includes/compatibility/class-wc-gzd-compatibility-wpml.php
CHANGED
@@ -128,18 +128,29 @@ class WC_GZD_Compatibility_Wpml extends WC_GZD_Compatibility {
|
|
128 |
return;
|
129 |
}
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
134 |
|
135 |
-
|
|
|
136 |
}
|
137 |
|
138 |
-
|
139 |
}
|
140 |
|
141 |
-
public function
|
142 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
add_filter( 'woocommerce_gzd_get_settings_filter', array( $this, 'add_admin_notices' ), 10, 1 );
|
144 |
add_filter( 'woocommerce_gzd_legal_checkbox_fields', array( $this, 'add_admin_notices_checkboxes' ), 10, 2 );
|
145 |
add_filter( 'woocommerce_gzd_admin_email_order_confirmation_text_option', array( $this, 'add_admin_notices_email' ), 10, 1 );
|
128 |
return;
|
129 |
}
|
130 |
|
131 |
+
add_action( 'admin_init', array( $this, 'set_filters' ), 50 );
|
132 |
+
}
|
133 |
+
|
134 |
+
protected function enable_option_filters() {
|
135 |
+
$enable = false;
|
136 |
|
137 |
+
if ( isset( $_GET['tab'] ) && ( 'germanized' === $_GET['tab'] || 'email' === $_GET['tab'] ) ) {
|
138 |
+
$enable = true;
|
139 |
}
|
140 |
|
141 |
+
return apply_filters( 'woocommerce_gzd_enable_wpml_string_translation_settings_filters', $enable );
|
142 |
}
|
143 |
|
144 |
+
public function set_filters() {
|
145 |
+
if ( $this->enable_option_filters() ) {
|
146 |
+
|
147 |
+
foreach( $this->get_translatable_options() as $option => $args ) {
|
148 |
+
add_filter( 'option_' . $option, array( $this, 'translate_option_filter' ), 10, 2 );
|
149 |
+
add_filter( 'pre_update_option_' . $option, array( $this, 'pre_update_translation_filter' ), 10, 3 );
|
150 |
+
|
151 |
+
wc_gzd_remove_class_filter( 'option_' . $option, 'WPML_Admin_Texts', 'icl_st_translate_admin_string', 10 );
|
152 |
+
}
|
153 |
+
|
154 |
add_filter( 'woocommerce_gzd_get_settings_filter', array( $this, 'add_admin_notices' ), 10, 1 );
|
155 |
add_filter( 'woocommerce_gzd_legal_checkbox_fields', array( $this, 'add_admin_notices_checkboxes' ), 10, 2 );
|
156 |
add_filter( 'woocommerce_gzd_admin_email_order_confirmation_text_option', array( $this, 'add_admin_notices_email' ), 10, 1 );
|
includes/wc-gzd-template-functions.php
CHANGED
@@ -160,7 +160,7 @@ if ( ! function_exists( 'woocommerce_gzd_template_checkout_set_terms_manually' )
|
|
160 |
* Set terms checkbox manually
|
161 |
*/
|
162 |
function woocommerce_gzd_template_checkout_set_terms_manually() {
|
163 |
-
echo '<input type="
|
164 |
}
|
165 |
|
166 |
}
|
160 |
* Set terms checkbox manually
|
161 |
*/
|
162 |
function woocommerce_gzd_template_checkout_set_terms_manually() {
|
163 |
+
echo '<input type="checkbox" name="terms" value="1" style="display: none;" />';
|
164 |
}
|
165 |
|
166 |
}
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: vendidero, vdwoocommercesupport
|
3 |
Tags: woocommerce, woocommerce german, woocommerce DE, woocommerce germany, woocommerce deutsch, woo
|
4 |
Requires at least: 3.8
|
5 |
-
Tested up to:
|
6 |
WC requires at least: 2.4
|
7 |
WC tested up to: 3.5
|
8 |
-
Stable tag: 2.2.
|
9 |
Requires PHP: 5.3
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -184,6 +184,12 @@ Bug reports may be filed via our [GitHub repository](https://github.com/vendider
|
|
184 |
|
185 |
== Changelog ==
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
= 2.2.1 =
|
188 |
* Fix: Make sure that order confirmation email is not being sent twice
|
189 |
* Improvement: Override on-hold-email to disallow triggering by third party plugins
|
2 |
Contributors: vendidero, vdwoocommercesupport
|
3 |
Tags: woocommerce, woocommerce german, woocommerce DE, woocommerce germany, woocommerce deutsch, woo
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 5.0
|
6 |
WC requires at least: 2.4
|
7 |
WC tested up to: 3.5
|
8 |
+
Stable tag: 2.2.2
|
9 |
Requires PHP: 5.3
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
184 |
|
185 |
== Changelog ==
|
186 |
|
187 |
+
= 2.2.2 =
|
188 |
+
* Fix: Load WPML Helper settings filter for settings screen only to avoid problems during admin actions
|
189 |
+
* Fix: Do not force tax calculation for fees if customer is a vat exempt
|
190 |
+
* Improvement: Keep hidden terms checkbox (woo builtin) in sync with GZD checkbox to avoid plugin conflicts
|
191 |
+
* Improvement: Use higher priority to refresh order fragments to avoid plugin conflicts
|
192 |
+
|
193 |
= 2.2.1 =
|
194 |
* Fix: Make sure that order confirmation email is not being sent twice
|
195 |
* Improvement: Override on-hold-email to disallow triggering by third party plugins
|
woocommerce-germanized.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: WooCommerce Germanized
|
4 |
* Plugin URI: https://www.vendidero.de/woocommerce-germanized
|
5 |
* Description: WooCommerce Germanized extends WooCommerce to become a legally compliant store in the german market.
|
6 |
-
* Version: 2.2.
|
7 |
* Author: Vendidero
|
8 |
* Author URI: https://vendidero.de
|
9 |
* Requires at least: 3.8
|
10 |
-
* Tested up to:
|
11 |
* WC requires at least: 2.4.0
|
12 |
* WC tested up to: 3.5.0
|
13 |
* Requires at least WooCommerce: 2.4
|
@@ -31,7 +31,7 @@ final class WooCommerce_Germanized {
|
|
31 |
*
|
32 |
* @var string
|
33 |
*/
|
34 |
-
public $version = '2.2.
|
35 |
|
36 |
/**
|
37 |
* Single instance of WooCommerce Germanized Main Class
|
@@ -734,9 +734,18 @@ final class WooCommerce_Germanized {
|
|
734 |
if ( wp_script_is( 'wc-gzd-checkout' ) && ! in_array( 'wc-gzd-checkout', $this->localized_scripts ) ) {
|
735 |
|
736 |
$this->localized_scripts[] = 'wc-gzd-checkout';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
|
738 |
wp_localize_script( 'wc-gzd-checkout', 'wc_gzd_checkout_params', apply_filters( 'wc_gzd_checkout_params', array(
|
739 |
-
'adjust_heading'
|
|
|
|
|
740 |
) ) );
|
741 |
}
|
742 |
|
@@ -904,7 +913,7 @@ final class WooCommerce_Germanized {
|
|
904 |
*/
|
905 |
public function remove_cart_unit_price_filter() {
|
906 |
if ( is_cart() ) {
|
907 |
-
remove_filter( 'woocommerce_cart_item_subtotal', 'wc_gzd_cart_product_unit_price', 0
|
908 |
}
|
909 |
}
|
910 |
|
3 |
* Plugin Name: WooCommerce Germanized
|
4 |
* Plugin URI: https://www.vendidero.de/woocommerce-germanized
|
5 |
* Description: WooCommerce Germanized extends WooCommerce to become a legally compliant store in the german market.
|
6 |
+
* Version: 2.2.2
|
7 |
* Author: Vendidero
|
8 |
* Author URI: https://vendidero.de
|
9 |
* Requires at least: 3.8
|
10 |
+
* Tested up to: 5.0
|
11 |
* WC requires at least: 2.4.0
|
12 |
* WC tested up to: 3.5.0
|
13 |
* Requires at least WooCommerce: 2.4
|
31 |
*
|
32 |
* @var string
|
33 |
*/
|
34 |
+
public $version = '2.2.2';
|
35 |
|
36 |
/**
|
37 |
* Single instance of WooCommerce Germanized Main Class
|
734 |
if ( wp_script_is( 'wc-gzd-checkout' ) && ! in_array( 'wc-gzd-checkout', $this->localized_scripts ) ) {
|
735 |
|
736 |
$this->localized_scripts[] = 'wc-gzd-checkout';
|
737 |
+
$html_id = 'legal';
|
738 |
+
$hide_input = false;
|
739 |
+
|
740 |
+
if ( $checkbox = wc_gzd_get_legal_checkbox( 'terms' ) ) {
|
741 |
+
$html_id = $checkbox->get_html_id();
|
742 |
+
$hide_input = $checkbox->hide_input();
|
743 |
+
}
|
744 |
|
745 |
wp_localize_script( 'wc-gzd-checkout', 'wc_gzd_checkout_params', apply_filters( 'wc_gzd_checkout_params', array(
|
746 |
+
'adjust_heading' => true,
|
747 |
+
'checkbox_id' => $html_id,
|
748 |
+
'checkbox_hidden' => $hide_input,
|
749 |
) ) );
|
750 |
}
|
751 |
|
913 |
*/
|
914 |
public function remove_cart_unit_price_filter() {
|
915 |
if ( is_cart() ) {
|
916 |
+
remove_filter( 'woocommerce_cart_item_subtotal', 'wc_gzd_cart_product_unit_price', 0 );
|
917 |
}
|
918 |
}
|
919 |
|