-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfield-removal-options.php
200 lines (177 loc) · 8.99 KB
/
field-removal-options.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
if ( !class_exists( 'RCF_WC_Remove_Checkout_Fields' ) ) {
class RCF_WC_Remove_Checkout_Fields {
public static function init() {
add_filter( 'woocommerce_settings_tabs_array', __CLASS__ . '::add_settings_tab', 50 );
add_action( 'woocommerce_settings_tabs_remove_checkout_fields', __CLASS__ . '::settings_tab' );
add_action( 'woocommerce_update_options_remove_checkout_fields', __CLASS__ . '::update_settings' );
}
public static function add_settings_tab( $settings_tabs ) {
$settings_tabs['remove_checkout_fields'] = __( 'Remove Checkout Fields', 'woocommerce-remove-checkout-fields' );
return $settings_tabs;
}
public static function settings_tab() {
woocommerce_admin_fields( self::get_settings() );
}
public static function update_settings() {
woocommerce_update_options( self::get_settings() );
}
public static function get_settings() {
$settings = array(
array(
'type' => 'title',
'desc' => __( '<b>Note:</b> You can remove fields and save settings without any hesitation as all settings are reversible. If you decide to show field again in future, you can simply uncheck the option for that field and save settings.', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_initial_note'
),
array(
'name' => __( 'Select Billing Fields to remove', 'Remove-Checkout-Fields' ),
'type' => 'title',
'id' => 'wc_remove-checkout-fields_billing_title'
),
array(
'name' => __( 'First Name', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( "Remove First Name field", 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_fname'
),
array(
'name' => __( 'Last Name', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Last Name field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_lname'
),
array(
'name' => __( 'Phone Number', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Phone field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_phone'
),
array(
'name' => __( 'Company', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Company name field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_company'
),
array(
'name' => __( 'Country', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Country / Region field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_country'
),
array(
'name' => __( 'Address 2', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove optional street address field Only', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_address2'
),
array(
'name' => __( 'Address', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove both Street Address FIelds (If it\'s enabled then no need to enable previous <strong>Address 2</strong> option)', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_address'
),
array(
'name' => __( 'City', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Town / City field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_city'
),
array(
'name' => __( 'State', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove State field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_state'
),
array(
'name' => __( 'Postcode', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove ZIP Code field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_billing_postcode'
),
array(
'type' => 'sectionend',
'id' => 'wc_remove-checkout-fields_billing_details_section_end'
),
array(
'name' => __( 'Select Shipping Fields to remove', 'Remove-Checkout-Fields' ),
'type' => 'title',
'id' => 'wc_remove-checkout-fields_shipping_title'
),
array(
'name' => __( 'First Name', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove First Name field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_fname'
),
array(
'name' => __( 'Last Name', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Last Name field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_lname'
),
array(
'name' => __( 'Company name', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Company field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_company'
),
array(
'name' => __( 'Country', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Country / Region field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_country'
),
array(
'name' => __( 'Address 2', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove optional street address field Only', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_address2'
),
array(
'name' => __( 'Address', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove both Street Address FIelds (If it\'s enabled then no need to enable previous <strong>Address 2</strong> option)', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_address'
),
array(
'name' => __( 'City', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Town / City field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_city'
),
array(
'name' => __( 'State', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove State field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_state'
),
array(
'name' => __( 'Postcode', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove ZIP Code field', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_Shipping_postcode'
),
array(
'type' => 'sectionend',
'id' => 'wc_remove-checkout-fields_shipping_details_section_end'
),
array(
'name' => __( 'Order Notes Section', 'Remove-Checkout-Fields' ),
'type' => 'title',
'id' => 'wc_remove-checkout-fields_order_notes_title'
),
array(
'name' => __( 'Order Notes Box', 'Remove-Checkout-Fields' ),
'type' => 'checkbox',
'desc' => __( 'Remove Order Notes Box on Checkout page', 'Remove-Checkout-Fields' ),
'id' => 'wc_remove-checkout-fields_order_notes'
),
array(
'type' => 'sectionend',
'id' => 'wc_remove-checkout-fields_order_notes_section_end'
)
);
return apply_filters( 'wc_remove-checkout-fields_settings', $settings );
}
}
}