WooCommerce Direct Checkout - Version 2.2.7

Version Description

  • Fix. WooCommerce Direct Checkout Premium compatibility
Download this release

Release Info

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

Code changes from version 2.2.6 to 2.2.7

assets/backend/img/quadlayers.jpg ADDED
Binary file
includes/archives.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  if (!defined('ABSPATH')) {
4
  die('-1');
5
  }
@@ -18,207 +17,95 @@ if (!class_exists('QLWCDC_Archives')) {
18
  return self::$instance;
19
  }
20
 
21
- function add_section($sections) {
22
-
23
- $sections['archives'] = esc_html__('Archives', 'woocommerce-direct-checkout');
 
 
 
24
 
25
- return $sections;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
- function add_fields($fields) {
29
 
30
  global $current_section;
31
 
32
  if ('archives' == $current_section) {
33
 
34
- $fields = array(
35
- 'qlwcdc_section_title' => array(
36
- 'name' => esc_html__('Archives', 'woocommerce-direct-checkout'),
37
- 'type' => 'title',
38
- 'id' => 'qlwcdc_archives_section_title'
39
- ),
40
- /*'add_archive_cart' => array(
41
- 'name' => esc_html__('Add to cart', 'woocommerce-direct-checkout'),
42
- 'desc_tip' => esc_html__('Add to cart button behaviour for single products in archives.', 'woocommerce-direct-checkout'),
43
- 'id' => 'qlwcdc_add_archive_cart',
44
- 'type' => 'select',
45
- 'class' => 'chosen_select',
46
- 'options' => array(
47
- 'no' => esc_html__('Reload', 'woocommerce-direct-checkout'),
48
- 'ajax' => esc_html__('Ajax', 'woocommerce-direct-checkout'),
49
- 'redirect' => esc_html__('Redirect', 'woocommerce-direct-checkout'),
50
- ),
51
- 'default' => 'no',
52
- ),
53
- 'add_archive_cart_ajax_button' => array(
54
- 'name' => esc_html__('Added to cart button', 'woocommerce-direct-checkout'),
55
- 'desc_tip' => esc_html__('Show or hide the added to cart forward button.', 'woocommerce-direct-checkout'),
56
- 'id' => 'qlwcdc_add_archive_cart_ajax_button',
57
- 'type' => 'select',
58
- 'options' => array(
59
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
60
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
61
- ),
62
- 'default' => 'no',
63
- ),
64
- 'add_archive_cart_ajax_message' => array(
65
- 'name' => esc_html__('Added to cart alert', 'woocommerce-direct-checkout'),
66
- 'desc_tip' => esc_html__('Include the "added to cart" alert message in product archives and shop.', 'woocommerce-direct-checkout'),
67
- 'id' => 'qlwcdc_add_archive_cart_ajax_message',
68
- 'type' => 'select',
69
- 'class' => 'chosen_select',
70
- 'options' => array(
71
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
72
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
73
- ),
74
- 'default' => 'yes',
75
- ),
76
- 'add_archive_cart_redirect_page' => array(
77
- 'name' => esc_html__('Added to cart redirect to', 'woocommerce-direct-checkout'),
78
- 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
79
- 'id' => 'qlwcdc_add_archive_cart_redirect_page',
80
- 'type' => 'select',
81
- 'class' => 'chosen_select',
82
- 'options' => array(
83
- 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
84
- 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
85
- 'url' => esc_html__('Custom URL', 'woocommerce-direct-checkout'),
86
- ),
87
- 'default' => 'cart',
88
- ),
89
- 'add_archive_cart_redirect_url' => array(
90
- 'name' => esc_html__('Added to cart redirect to custom url', 'woocommerce-direct-checkout'),
91
- 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
92
- 'id' => 'qlwcdc_add_archive_cart_redirect_url',
93
- 'type' => 'text',
94
- 'placeholder' => wc_get_checkout_url(),
95
- ),*/
96
- 'add_archive_text' => array(
97
- 'name' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
98
- 'desc_tip' => esc_html__('Replace "Add to cart" text.', 'woocommerce-direct-checkout'),
99
- 'id' => 'qlwcdc_add_archive_text',
100
- 'type' => 'select',
101
- 'class' => 'chosen_select',
102
- 'options' => array(
103
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
104
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
105
- ),
106
- 'default' => 'no',
107
- ),
108
- 'add_archive_text_in' => array(
109
- 'name' => esc_html__('Replace Add to cart text in', 'woocommerce-direct-checkout'),
110
- 'desc_tip' => esc_html__('Replace "Add to cart" text in product types.', 'woocommerce-direct-checkout'),
111
- 'id' => 'qlwcdc_add_archive_text_in',
112
- 'type' => 'multiselect',
113
- 'class' => 'chosen_select',
114
- 'options' => array(
115
- 'simple' => esc_html__('Simple Products', 'woocommerce-direct-checkout'),
116
- 'grouped' => esc_html__('Grouped Products', 'woocommerce-direct-checkout'),
117
- 'virtual' => esc_html__('Virtual Products', 'woocommerce-direct-checkout'),
118
- 'variable' => esc_html__('Variable Products', 'woocommerce-direct-checkout'),
119
- 'downloadable' => esc_html__('Downloadable Products', 'woocommerce-direct-checkout'),
120
- ),
121
- 'default' => array('simple'),
122
- ),
123
- 'add_archive_text_content' => array(
124
- 'name' => esc_html__('Replace Add to cart text content', 'woocommerce-direct-checkout'),
125
- 'desc_tip' => esc_html__('Replace "Add to cart" text with this text.', 'woocommerce-direct-checkout'),
126
- 'id' => 'qlwcdc_add_archive_text_content',
127
- 'type' => 'text',
128
- 'default' => esc_html__('Purchase', 'woocommerce-direct-checkout'),
129
- ),
130
- 'add_archive_quick_view' => array(
131
- 'name' => esc_html__('Add quick view button', 'woocommerce-direct-checkout'),
132
- 'desc_tip' => esc_html__('Add product quick view modal button.', 'woocommerce-direct-checkout'),
133
- 'id' => 'qlwcdc_add_archive_quick_view',
134
- 'type' => 'select',
135
- 'class' => 'chosen_select qlwcdc-premium-field',
136
- 'options' => array(
137
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
138
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
139
- ),
140
- 'default' => 'no',
141
- ),
142
- 'qlwcdc_section_end' => array(
143
- 'type' => 'sectionend',
144
- 'id' => 'qlwcdc_archives_section_end'
145
- )
146
- );
147
- }
148
-
149
- return $fields;
150
- }
151
-
152
- function add_settings() {
153
-
154
- global $current_section;
155
 
156
- if ('' == $current_section) {
157
- woocommerce_admin_fields($this->add_fields());
158
  }
159
  }
160
 
161
- /*function add_to_cart_redirect($url) {
162
-
163
- if (is_shop() || is_product_category() || is_product_tag()) {
164
-
165
- if ('redirect' === get_option('qlwcdc_add_archive_cart')) {
166
-
167
- if ('cart' === get_option('qlwcdc_add_archive_cart_redirect_page')) {
168
- $url = wc_get_cart_url();
169
- }
170
-
171
- if ('checkout' === get_option('qlwcdc_add_archive_cart_redirect_page')) {
172
- $url = wc_get_checkout_url();
173
- }
174
-
175
- if ('url' === get_option('qlwcdc_add_archive_cart_redirect_page')) {
176
- $url = get_option('qlwcdc_add_archive_cart_redirect_url');
177
- }
178
- }
179
- }
180
-
181
- return $url;
182
- }*/
183
-
184
- /*function added_to_cart_button() {
185
- if (!is_product() && 'no' === get_option('qlwcdc_add_archive_cart_ajax_button', 'no')) {
186
- ?>
187
- <style>
188
- .added_to_cart.wc-forward {
189
- display: none!important;
190
- }
191
- </style>
192
- <?php
193
 
194
- }
195
- }*/
196
-
197
- /*function added_to_cart_message($product_id) {
198
-
199
- if (!is_product() && 'ajax' === get_option('qlwcdc_add_archive_cart', 'no') && 'yes' === get_option('qlwcdc_add_archive_cart_ajax_message', 'yes')) {
200
-
201
- $quantity = empty($_POST['quantity']) ? 1 : wc_stock_amount($_POST['quantity']);
202
-
203
- wc_add_to_cart_message(array($product_id => $quantity), true);
204
- }
205
- }*/
206
-
207
- /*function added_to_cart_message_js($product_id) {
208
 
209
- if (!is_product() && 'ajax' === get_option('qlwcdc_add_archive_cart') && 'yes' === get_option('qlwcdc_add_archive_cart_ajax_message')) {
210
- ?>
211
- <script>
212
- (function ($) {
213
- $(document).bind('added_to_cart', function (e, cart) {
214
- $(document.body).trigger('added_to_cart_message', [e, cart]);
215
- });
216
- })(jQuery);
217
- </script>
218
- <?php
219
 
 
220
  }
221
- }*/
222
 
223
  function add_archive_text($text, $product) {
224
 
@@ -231,40 +118,11 @@ if (!class_exists('QLWCDC_Archives')) {
231
  return $text;
232
  }
233
 
234
- /*function woocommerce_enable_ajax_add_to_cart($val) {
235
-
236
- if ('no' !== get_option('qlwcdc_add_archive_cart', 'no')) {
237
- $val = 'yes';
238
- } else {
239
- $val = 'no';
240
- }
241
-
242
- return $val;
243
- }*/
244
-
245
- /*function woocommerce_cart_redirect_after_add($val) {
246
-
247
- if (is_shop() || is_product_category() || is_product_tag()) {
248
- if ('redirect' === get_option('qlwcdc_add_archive_cart', 'no')) {
249
- $val = 'yes';
250
- } else {
251
- $val = 'no';
252
- }
253
- }
254
-
255
- return $val;
256
- }*/
257
-
258
  function init() {
259
- add_filter('qlwcdc_add_sections', array($this, 'add_section'));
260
- add_filter('qlwcdc_add_fields', array($this, 'add_fields'));
261
- //add_filter('woocommerce_add_to_cart_redirect', array($this, 'add_to_cart_redirect'));
262
- //add_filter('woocommerce_before_shop_loop', array($this, 'added_to_cart_button'));
263
- //add_filter('woocommerce_after_shop_loop', array($this, 'added_to_cart_message_js'));
264
- //add_action('woocommerce_ajax_added_to_cart', array($this, 'added_to_cart_message'));
265
  add_filter('woocommerce_product_add_to_cart_text', array($this, 'add_archive_text'), 10, 2);
266
- //add_filter('option_woocommerce_enable_ajax_add_to_cart', array($this, 'woocommerce_enable_ajax_add_to_cart'));
267
- //add_filter('option_woocommerce_cart_redirect_after_add', array($this, 'woocommerce_cart_redirect_after_add'));
268
  }
269
 
270
  }
1
  <?php
 
2
  if (!defined('ABSPATH')) {
3
  die('-1');
4
  }
17
  return self::$instance;
18
  }
19
 
20
+ function add_header() {
21
+ global $current_section;
22
+ ?>
23
+ <li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . QLWCDC_PREFIX . '&section=archives'); ?>" class="<?php echo ( $current_section == 'archives' ? 'current' : '' ); ?>"><?php esc_html_e('Archives', 'woocommerce-direct-checkout'); ?></a> | </li>
24
+ <?php
25
+ }
26
 
27
+ function get_settings() {
28
+
29
+ return array(
30
+ array(
31
+ 'name' => esc_html__('Archives', 'woocommerce-direct-checkout'),
32
+ 'type' => 'title',
33
+ 'id' => 'qlwcdc_archives_section_title'
34
+ ),
35
+ array(
36
+ 'name' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
37
+ 'desc_tip' => esc_html__('Replace "Add to cart" text.', 'woocommerce-direct-checkout'),
38
+ 'id' => 'qlwcdc_add_archive_text',
39
+ 'type' => 'select',
40
+ 'class' => 'chosen_select',
41
+ 'options' => array(
42
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
43
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
44
+ ),
45
+ 'default' => 'no',
46
+ ),
47
+ array(
48
+ 'name' => esc_html__('Replace Add to cart text in', 'woocommerce-direct-checkout'),
49
+ 'desc_tip' => esc_html__('Replace "Add to cart" text in product types.', 'woocommerce-direct-checkout'),
50
+ 'id' => 'qlwcdc_add_archive_text_in',
51
+ 'type' => 'multiselect',
52
+ 'class' => 'chosen_select',
53
+ 'options' => array(
54
+ 'simple' => esc_html__('Simple Products', 'woocommerce-direct-checkout'),
55
+ 'grouped' => esc_html__('Grouped Products', 'woocommerce-direct-checkout'),
56
+ 'virtual' => esc_html__('Virtual Products', 'woocommerce-direct-checkout'),
57
+ 'variable' => esc_html__('Variable Products', 'woocommerce-direct-checkout'),
58
+ 'downloadable' => esc_html__('Downloadable Products', 'woocommerce-direct-checkout'),
59
+ ),
60
+ 'default' => array('simple'),
61
+ ),
62
+ array(
63
+ 'name' => esc_html__('Replace Add to cart text content', 'woocommerce-direct-checkout'),
64
+ 'desc_tip' => esc_html__('Replace "Add to cart" text with this text.', 'woocommerce-direct-checkout'),
65
+ 'id' => 'qlwcdc_add_archive_text_content',
66
+ 'type' => 'text',
67
+ 'default' => esc_html__('Purchase', 'woocommerce-direct-checkout'),
68
+ ),
69
+ array(
70
+ 'name' => esc_html__('Add quick view button', 'woocommerce-direct-checkout'),
71
+ 'desc_tip' => esc_html__('Add product quick view modal button.', 'woocommerce-direct-checkout'),
72
+ 'id' => 'qlwcdc_add_archive_quick_view',
73
+ 'type' => 'select',
74
+ 'class' => 'chosen_select qlwcdc-premium-field',
75
+ 'options' => array(
76
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
77
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
78
+ ),
79
+ 'default' => 'no',
80
+ ),
81
+ array(
82
+ 'type' => 'sectionend',
83
+ 'id' => 'qlwcdc_archives_section_end'
84
+ )
85
+ );
86
  }
87
 
88
+ function add_section() {
89
 
90
  global $current_section;
91
 
92
  if ('archives' == $current_section) {
93
 
94
+ $settings = $this->get_settings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/pages/archives.php' );
 
97
  }
98
  }
99
 
100
+ function save_settings() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ global $current_section;
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
+ if ('archives' == $current_section) {
 
 
 
 
 
 
 
 
 
105
 
106
+ woocommerce_update_options($this->get_settings());
107
  }
108
+ }
109
 
110
  function add_archive_text($text, $product) {
111
 
118
  return $text;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  function init() {
122
+ add_action('qlwcdc_sections_header', array($this, 'add_header'));
123
+ add_action('woocommerce_sections_' . QLWCDC_PREFIX, array($this, 'add_section'), 99);
124
+ add_action('woocommerce_settings_save_' . QLWCDC_PREFIX, array($this, 'save_settings'));
 
 
 
125
  add_filter('woocommerce_product_add_to_cart_text', array($this, 'add_archive_text'), 10, 2);
 
 
126
  }
127
 
128
  }
includes/checkout.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  if (!defined('ABSPATH')) {
4
  die('-1');
5
  }
@@ -18,194 +17,209 @@ if (!class_exists('QLWCDC_Checkout')) {
18
  return self::$instance;
19
  }
20
 
21
- function add_section($sections) {
 
 
 
 
 
22
 
23
- $sections['checkout'] = esc_html__('Checkout', 'woocommerce-direct-checkout');
24
 
25
- return $sections;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
- function add_fields($settings) {
29
 
30
  global $current_section;
31
 
32
  if ('checkout' == $current_section) {
33
 
34
- $settings = array(
35
- 'section_title' => array(
36
- 'name' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
37
- 'type' => 'title',
38
- 'id' => 'section_title'
39
- ),
40
- 'add_checkout_cart' => array(
41
- 'name' => esc_html__('Add cart to checkout', 'woocommerce-direct-checkout'),
42
- 'desc_tip' => esc_html__('Simplifies the checkout process including the shopping cart page inside checkout.', 'woocommerce-direct-checkout'),
43
- 'id' => 'qlwcdc_add_checkout_cart',
44
- 'type' => 'select',
45
- 'class' => 'chosen_select',
46
- 'options' => array(
47
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
48
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
49
- ),
50
- 'default' => 'no',
51
- ),
52
- 'add_checkout_cart_fields' => array(
53
- 'name' => esc_html__('Add cart to checkout fields', 'woocommerce-direct-checkout'),
54
- 'desc_tip' => esc_html__('Include this fields inside the checkout cart.', 'woocommerce-direct-checkout'),
55
- 'id' => 'qlwcdc_add_checkout_cart_fields',
56
- 'type' => 'multiselect',
57
- 'class' => 'chosen_select',
58
- 'options' => array(
59
- 'remove' => esc_html__('Remove', 'woocommerce-direct-checkout'),
60
- 'thumbnail' => esc_html__('Thumbnail', 'woocommerce-direct-checkout'),
61
- 'name' => esc_html__('Name', 'woocommerce-direct-checkout'),
62
- 'price' => esc_html__('Price', 'woocommerce-direct-checkout'),
63
- 'qty' => esc_html__('Quantity', 'woocommerce-direct-checkout'),
64
- ),
65
- 'default' => array(
66
- 0 => 'remove',
67
- 1 => 'thumbnail',
68
- 2 => 'price',
69
- 3 => 'qty',
70
- )
71
- ),
72
- 'remove_checkout_coupon_form' => array(
73
- 'name' => esc_html__('Remove checkout coupon form', 'woocommerce-direct-checkout'),
74
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the coupon form.', 'woocommerce-direct-checkout'),
75
- 'id' => 'qlwcdc_remove_checkout_coupon_form',
76
- 'type' => 'select',
77
- 'class' => 'chosen_select',
78
- 'options' => array(
79
- 'no' => esc_html__('Leave coupon form', 'woocommerce-direct-checkout'),
80
- 'remove' => esc_html__('Remove coupon form', 'woocommerce-direct-checkout'),
81
- 'toggle' => esc_html__('Remove coupon toggle', 'woocommerce-direct-checkout'),
82
- 'checkout' => esc_html__('Move to checkout order', 'woocommerce-direct-checkout'),
83
- ),
84
- 'default' => 'no',
85
- ),
86
- 'add_checkout_cart_class' => array(
87
- 'name' => esc_html__('Add custom class to cart table', 'woocommerce-direct-checkout'),
88
- 'desc_tip' => esc_html__('Add a custom class to the cart table form in the checkot.', 'woocommerce-direct-checkout'),
89
- 'id' => 'qlwcdc_add_checkout_cart_class',
90
- 'type' => 'text',
91
- 'default' => ''
92
- ),
93
- 'remove_checkout_fields' => array(
94
- 'name' => esc_html__('Remove checkout fields', 'qlwe'),
95
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the unnecessary checkout fields.', 'qlwe'),
96
- 'id' => 'qlwcdc_remove_checkout_fields',
97
- 'type' => 'multiselect',
98
- 'class' => 'chosen_select',
99
- 'options' => array(
100
- 'first_name' => esc_html__('First Name', 'qlwe'),
101
- 'last_name' => esc_html__('Last Name', 'qlwe'),
102
- 'country' => esc_html__('Country', 'qlwe'),
103
- 'state' => esc_html__('State', 'qlwe'),
104
- 'city' => esc_html__('City', 'qlwe'),
105
- 'postcode' => esc_html__('Postcode', 'qlwe'),
106
- 'address_1' => esc_html__('Address 1', 'qlwe'),
107
- 'address_2' => esc_html__('Address 2', 'qlwe'),
108
- 'company' => esc_html__('Company', 'qlwe'),
109
- 'phone' => esc_html__('Phone', 'qlwe'),
110
- ),
111
- 'default' => array(
112
- 0 => 'phone',
113
- 1 => 'company',
114
- 2 => 'address_2',
115
- )
116
- ),
117
- 'remove_checkout_shipping_address' => array(
118
- 'name' => esc_html__('Remove checkout shipping address', 'woocommerce-direct-checkout'),
119
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the shipping address.', 'woocommerce-direct-checkout'),
120
- 'id' => 'qlwcdc_remove_checkout_shipping_address',
121
- 'type' => 'select',
122
- 'class' => 'chosen_select',
123
- 'options' => array(
124
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
125
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
126
- ),
127
- 'default' => 'no',
128
- ),
129
- 'remove_checkout_order_comments' => array(
130
- 'name' => esc_html__('Remove checkout order comments', 'woocommerce-direct-checkout'),
131
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the order notes.', 'woocommerce-direct-checkout'),
132
- 'id' => 'qlwcdc_remove_checkout_order_comments',
133
- 'type' => 'select',
134
- 'class' => 'chosen_select',
135
- 'options' => array(
136
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
137
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
138
- ),
139
- 'default' => 'no',
140
- ),
141
- 'remove_checkout_privacy_policy_text' => array(
142
- 'name' => esc_html__('Remove checkout policy text', 'woocommerce-direct-checkout'),
143
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the policy text.', 'woocommerce-direct-checkout'),
144
- 'id' => 'qlwcdc_remove_checkout_privacy_policy_text',
145
- 'type' => 'select',
146
- 'class' => 'chosen_select qlwcdc-premium-field',
147
- 'options' => array(
148
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
149
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
150
- ),
151
- 'default' => 'no',
152
- ),
153
- 'remove_checkout_terms_and_conditions' => array(
154
- 'name' => esc_html__('Remove checkout terms and conditions', 'woocommerce-direct-checkout'),
155
- 'desc_tip' => esc_html__('Simplifies the checkout process removing the terms and conditions.', 'woocommerce-direct-checkout'),
156
- 'id' => 'qlwcdc_remove_checkout_terms_and_conditions',
157
- 'type' => 'select',
158
- 'class' => 'chosen_select',
159
- 'options' => array(
160
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
161
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
162
- ),
163
- 'default' => 'no',
164
- ),
165
- 'remove_checkout_gateway_icon' => array(
166
- 'name' => esc_html__('Remove checkout gateway icons', 'woocommerce-direct-checkout'),
167
- 'desc_tip' => esc_html__('Simplifies the checkout view by removing the payment gateway icons.', 'woocommerce-direct-checkout'),
168
- 'id' => 'qlwcdc_remove_checkout_gateway_icon',
169
- 'type' => 'select',
170
- 'class' => 'chosen_select qlwcdc-premium-field',
171
- 'options' => array(
172
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
173
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
174
- ),
175
- 'default' => 'no',
176
- ),
177
- 'remove_checkout_columns' => array(
178
- 'name' => esc_html__('Remove checkout columns', 'woocommerce-direct-checkout'),
179
- 'desc_tip' => esc_html__('Try to remove the columns and display the checkout form and order review in one column.', 'woocommerce-direct-checkout'),
180
- 'id' => 'qlwcdc_remove_checkout_columns',
181
- 'type' => 'select',
182
- 'class' => 'chosen_select',
183
- 'options' => array(
184
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
185
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
186
- ),
187
- 'default' => 'no',
188
- ),
189
- 'remove_order_details_address' => array(
190
- 'name' => esc_html__('Remove order details address', 'woocommerce-direct-checkout'),
191
- 'desc_tip' => esc_html__('Remove the billing address of the customer in the order received page.', 'woocommerce-direct-checkout'),
192
- 'id' => 'qlwcdc_remove_order_details_address',
193
- 'type' => 'select',
194
- 'class' => 'chosen_select',
195
- 'options' => array(
196
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
197
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
198
- ),
199
- 'default' => 'no',
200
- ),
201
- 'section_end' => array(
202
- 'type' => 'sectionend',
203
- 'id' => 'wc_settings_tab_demo_section_end'
204
- )
205
- );
206
  }
 
 
 
207
 
208
- return $settings;
 
 
 
 
 
209
  }
210
 
211
  function remove_checkout_fields($fields) {
@@ -240,9 +254,9 @@ if (!class_exists('QLWCDC_Checkout')) {
240
  }
241
 
242
  function init() {
243
-
244
- add_filter('qlwcdc_add_sections', array($this, 'add_section'));
245
- add_filter('qlwcdc_add_fields', array($this, 'add_fields'));
246
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
247
  add_filter('woocommerce_enable_order_notes_field', array($this, 'remove_checkout_order_commens'));
248
  add_filter('option_woocommerce_ship_to_destination', array($this, 'remove_checkout_shipping_address'), 10, 3);
1
  <?php
 
2
  if (!defined('ABSPATH')) {
3
  die('-1');
4
  }
17
  return self::$instance;
18
  }
19
 
20
+ function add_header() {
21
+ global $current_section;
22
+ ?>
23
+ <li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . QLWCDC_PREFIX . '&section=checkout'); ?>" class="<?php echo ( $current_section == 'checkout' ? 'current' : '' ); ?>"><?php esc_html_e('Checkout', 'woocommerce-direct-checkout'); ?></a> | </li>
24
+ <?php
25
+ }
26
 
27
+ function get_settings() {
28
 
29
+ return array(
30
+ array(
31
+ 'name' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
32
+ 'type' => 'title',
33
+ 'id' => 'section_title'
34
+ ),
35
+ array(
36
+ 'name' => esc_html__('Add cart to checkout', 'woocommerce-direct-checkout'),
37
+ 'desc_tip' => esc_html__('Simplifies the checkout process including the shopping cart page inside checkout.', 'woocommerce-direct-checkout'),
38
+ 'id' => 'qlwcdc_add_checkout_cart',
39
+ 'type' => 'select',
40
+ 'class' => 'chosen_select',
41
+ 'options' => array(
42
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
43
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
44
+ ),
45
+ 'default' => 'no',
46
+ ),
47
+ array(
48
+ 'name' => esc_html__('Add cart to checkout fields', 'woocommerce-direct-checkout'),
49
+ 'desc_tip' => esc_html__('Include this fields inside the checkout cart.', 'woocommerce-direct-checkout'),
50
+ 'id' => 'qlwcdc_add_checkout_cart_fields',
51
+ 'type' => 'multiselect',
52
+ 'class' => 'chosen_select',
53
+ 'options' => array(
54
+ 'remove' => esc_html__('Remove', 'woocommerce-direct-checkout'),
55
+ 'thumbnail' => esc_html__('Thumbnail', 'woocommerce-direct-checkout'),
56
+ 'name' => esc_html__('Name', 'woocommerce-direct-checkout'),
57
+ 'price' => esc_html__('Price', 'woocommerce-direct-checkout'),
58
+ 'qty' => esc_html__('Quantity', 'woocommerce-direct-checkout'),
59
+ ),
60
+ 'default' => array(
61
+ 0 => 'remove',
62
+ 1 => 'thumbnail',
63
+ 2 => 'price',
64
+ 3 => 'qty',
65
+ )
66
+ ),
67
+ array(
68
+ 'name' => esc_html__('Remove checkout coupon form', 'woocommerce-direct-checkout'),
69
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the coupon form.', 'woocommerce-direct-checkout'),
70
+ 'id' => 'qlwcdc_remove_checkout_coupon_form',
71
+ 'type' => 'select',
72
+ 'class' => 'chosen_select',
73
+ 'options' => array(
74
+ 'no' => esc_html__('Leave coupon form', 'woocommerce-direct-checkout'),
75
+ 'remove' => esc_html__('Remove coupon form', 'woocommerce-direct-checkout'),
76
+ 'toggle' => esc_html__('Remove coupon toggle', 'woocommerce-direct-checkout'),
77
+ 'checkout' => esc_html__('Move to checkout order', 'woocommerce-direct-checkout'),
78
+ ),
79
+ 'default' => 'no',
80
+ ),
81
+ array(
82
+ 'name' => esc_html__('Add custom class to cart table', 'woocommerce-direct-checkout'),
83
+ 'desc_tip' => esc_html__('Add a custom class to the cart table form in the checkot.', 'woocommerce-direct-checkout'),
84
+ 'id' => 'qlwcdc_add_checkout_cart_class',
85
+ 'type' => 'text',
86
+ 'default' => ''
87
+ ),
88
+ array(
89
+ 'name' => esc_html__('Remove checkout fields', 'qlwe'),
90
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the unnecessary checkout fields.', 'qlwe'),
91
+ 'id' => 'qlwcdc_remove_checkout_fields',
92
+ 'type' => 'multiselect',
93
+ 'class' => 'chosen_select',
94
+ 'options' => array(
95
+ 'first_name' => esc_html__('First Name', 'qlwe'),
96
+ 'last_name' => esc_html__('Last Name', 'qlwe'),
97
+ 'country' => esc_html__('Country', 'qlwe'),
98
+ 'state' => esc_html__('State', 'qlwe'),
99
+ 'city' => esc_html__('City', 'qlwe'),
100
+ 'postcode' => esc_html__('Postcode', 'qlwe'),
101
+ 'address_1' => esc_html__('Address 1', 'qlwe'),
102
+ 'address_2' => esc_html__('Address 2', 'qlwe'),
103
+ 'company' => esc_html__('Company', 'qlwe'),
104
+ 'phone' => esc_html__('Phone', 'qlwe'),
105
+ ),
106
+ 'default' => array(
107
+ 0 => 'phone',
108
+ 1 => 'company',
109
+ 2 => 'address_2',
110
+ )
111
+ ),
112
+ array(
113
+ 'name' => esc_html__('Remove checkout shipping address', 'woocommerce-direct-checkout'),
114
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the shipping address.', 'woocommerce-direct-checkout'),
115
+ 'id' => 'qlwcdc_remove_checkout_shipping_address',
116
+ 'type' => 'select',
117
+ 'class' => 'chosen_select',
118
+ 'options' => array(
119
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
120
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
121
+ ),
122
+ 'default' => 'no',
123
+ ),
124
+ array(
125
+ 'name' => esc_html__('Remove checkout order comments', 'woocommerce-direct-checkout'),
126
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the order notes.', 'woocommerce-direct-checkout'),
127
+ 'id' => 'qlwcdc_remove_checkout_order_comments',
128
+ 'type' => 'select',
129
+ 'class' => 'chosen_select',
130
+ 'options' => array(
131
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
132
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
133
+ ),
134
+ 'default' => 'no',
135
+ ),
136
+ array(
137
+ 'name' => esc_html__('Remove checkout policy text', 'woocommerce-direct-checkout'),
138
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the policy text.', 'woocommerce-direct-checkout'),
139
+ 'id' => 'qlwcdc_remove_checkout_privacy_policy_text',
140
+ 'type' => 'select',
141
+ 'class' => 'chosen_select qlwcdc-premium-field',
142
+ 'options' => array(
143
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
144
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
145
+ ),
146
+ 'default' => 'no',
147
+ ),
148
+ array(
149
+ 'name' => esc_html__('Remove checkout terms and conditions', 'woocommerce-direct-checkout'),
150
+ 'desc_tip' => esc_html__('Simplifies the checkout process removing the terms and conditions.', 'woocommerce-direct-checkout'),
151
+ 'id' => 'qlwcdc_remove_checkout_terms_and_conditions',
152
+ 'type' => 'select',
153
+ 'class' => 'chosen_select',
154
+ 'options' => array(
155
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
156
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
157
+ ),
158
+ 'default' => 'no',
159
+ ),
160
+ array(
161
+ 'name' => esc_html__('Remove checkout gateway icons', 'woocommerce-direct-checkout'),
162
+ 'desc_tip' => esc_html__('Simplifies the checkout view by removing the payment gateway icons.', 'woocommerce-direct-checkout'),
163
+ 'id' => 'qlwcdc_remove_checkout_gateway_icon',
164
+ 'type' => 'select',
165
+ 'class' => 'chosen_select qlwcdc-premium-field',
166
+ 'options' => array(
167
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
168
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
169
+ ),
170
+ 'default' => 'no',
171
+ ),
172
+ array(
173
+ 'name' => esc_html__('Remove checkout columns', 'woocommerce-direct-checkout'),
174
+ 'desc_tip' => esc_html__('Try to remove the columns and display the checkout form and order review in one column.', 'woocommerce-direct-checkout'),
175
+ 'id' => 'qlwcdc_remove_checkout_columns',
176
+ 'type' => 'select',
177
+ 'class' => 'chosen_select',
178
+ 'options' => array(
179
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
180
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
181
+ ),
182
+ 'default' => 'no',
183
+ ),
184
+ array(
185
+ 'name' => esc_html__('Remove order details address', 'woocommerce-direct-checkout'),
186
+ 'desc_tip' => esc_html__('Remove the billing address of the customer in the order received page.', 'woocommerce-direct-checkout'),
187
+ 'id' => 'qlwcdc_remove_order_details_address',
188
+ 'type' => 'select',
189
+ 'class' => 'chosen_select',
190
+ 'options' => array(
191
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
192
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
193
+ ),
194
+ 'default' => 'no',
195
+ ),
196
+ array(
197
+ 'type' => 'sectionend',
198
+ 'id' => 'wc_settings_tab_demo_section_end'
199
+ )
200
+ );
201
  }
202
 
203
+ function add_section() {
204
 
205
  global $current_section;
206
 
207
  if ('checkout' == $current_section) {
208
 
209
+ $settings = $this->get_settings();
210
+
211
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/pages/checkout.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  }
213
+ }
214
+
215
+ function save_settings() {
216
 
217
+ global $current_section;
218
+
219
+ if ('checkout' == $current_section) {
220
+
221
+ woocommerce_update_options($this->get_settings());
222
+ }
223
  }
224
 
225
  function remove_checkout_fields($fields) {
254
  }
255
 
256
  function init() {
257
+ add_action('qlwcdc_sections_header', array($this, 'add_header'));
258
+ add_action('woocommerce_sections_' . QLWCDC_PREFIX, array($this, 'add_section'), 99);
259
+ add_action('woocommerce_settings_save_' . QLWCDC_PREFIX, array($this, 'save_settings'));
260
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
261
  add_filter('woocommerce_enable_order_notes_field', array($this, 'remove_checkout_order_commens'));
262
  add_filter('option_woocommerce_ship_to_destination', array($this, 'remove_checkout_shipping_address'), 10, 3);
includes/general.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  if (!defined('ABSPATH')) {
4
  die('-1');
5
  }
@@ -18,114 +17,129 @@ if (!class_exists('QLWCDC_General')) {
18
  return self::$instance;
19
  }
20
 
21
- function add_section($sections) {
22
-
23
- $sections[''] = esc_html__('General', 'woocommerce-direct-checkout');
24
-
25
- return $sections;
26
- }
27
-
28
- function add_fields($settings) {
29
-
30
  global $current_section;
 
 
 
 
31
 
32
- if ('' == $current_section) {
33
 
34
- $settings = array(
35
- 'qlwcdc_section_title' => array(
36
- 'name' => esc_html__('General', 'woocommerce-direct-checkout'),
37
- 'type' => 'title',
38
- 'desc' => esc_html__('Simplifies the checkout process.', 'woocommerce-direct-checkout'),
39
- 'id' => 'qlwcdc_section_title'
40
- ),
41
- 'add_to_cart_message' => array(
42
- 'name' => esc_html__('Added to cart alert', 'woocommerce-direct-checkout'),
43
- 'desc_tip' => esc_html__('Replace "View Cart" alert with direct checkout.', 'woocommerce-direct-checkout'),
44
- 'id' => 'qlwcdc_add_to_cart_message',
45
- 'type' => 'select',
46
- 'class' => 'chosen_select',
47
- 'options' => array(
48
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
49
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
50
- ),
51
- 'default' => 'no',
52
- ),
53
- 'add_to_cart_link' => array(
54
- 'name' => esc_html__('Added to cart link', 'woocommerce-direct-checkout'),
55
- 'desc_tip' => esc_html__('Replace "View Cart" link with direct checkout.', 'woocommerce-direct-checkout'),
56
- 'id' => 'qlwcdc_add_to_cart_link',
57
- 'type' => 'select',
58
- 'class' => 'chosen_select',
59
- 'options' => array(
60
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
61
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
62
- ),
63
- 'default' => 'no',
64
- ),
65
- 'add_to_cart' => array(
66
- 'name' => esc_html__('Added to cart redirect', 'woocommerce-direct-checkout'),
67
- 'desc_tip' => esc_html__('Add to cart button behaviour.', 'woocommerce-direct-checkout'),
68
- 'id' => 'qlwcdc_add_to_cart',
69
- 'type' => 'select',
70
- 'class' => 'chosen_select',
71
- 'options' => array(
72
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
73
- //'ajax' => esc_html__('Ajax', 'woocommerce-direct-checkout'),
74
- 'redirect' => esc_html__('Yes', 'woocommerce-direct-checkout'),
75
- ),
76
- 'default' => 'no',
77
- ),
78
- /* 'add_to_cart_ajax_button' => array(
79
- 'name' => esc_html__('Added to cart button', 'woocommerce-direct-checkout'),
80
- 'desc_tip' => esc_html__('Show or hide the added to cart forward button.', 'woocommerce-direct-checkout'),
81
- 'id' => 'qlwcdc_add_to_cart_ajax_button',
82
  'type' => 'select',
 
83
  'options' => array(
84
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
85
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
86
  ),
87
  'default' => 'no',
88
- ), */
89
- /* 'add_to_cart_ajax_message' => array(
90
- 'name' => esc_html__('Added to cart alert', 'woocommerce-direct-checkout'),
91
- 'desc_tip' => esc_html__('Include the "added to cart" alert message in product archives and shop.', 'woocommerce-direct-checkout'),
92
- 'id' => 'qlwcdc_add_to_cart_ajax_message',
 
 
 
 
 
 
 
 
 
 
 
 
93
  'type' => 'select',
94
  'class' => 'chosen_select',
95
  'options' => array(
96
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
97
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
 
98
  ),
99
- 'default' => 'yes',
100
- ), */
101
- 'add_to_cart_redirect_page' => array(
102
- 'name' => esc_html__('Added to cart redirect to', 'woocommerce-direct-checkout'),
103
- 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
104
- 'id' => 'qlwcdc_add_to_cart_redirect_page',
105
- 'type' => 'select',
106
- 'class' => 'chosen_select',
107
- 'options' => array(
108
- 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
109
- 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
110
- 'url' => esc_html__('Custom URL', 'woocommerce-direct-checkout'),
111
- ),
112
- 'default' => 'cart',
113
  ),
114
- 'add_to_cart_redirect_url' => array(
115
- 'name' => esc_html__('Added to cart redirect to custom url', 'woocommerce-direct-checkout'),
116
- 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
117
- 'id' => 'qlwcdc_add_to_cart_redirect_url',
118
- 'type' => 'text',
119
- 'placeholder' => wc_get_checkout_url(),
 
 
 
 
 
120
  ),
121
- 'qlwcdc_section_end' => array(
122
- 'type' => 'sectionend',
123
- 'id' => 'qlwcdc_section_end'
124
- )
125
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
 
 
 
 
 
 
 
127
 
128
- return $settings;
 
129
  }
130
 
131
  function add_to_cart_params($params) {
@@ -166,8 +180,10 @@ if (!class_exists('QLWCDC_General')) {
166
  }
167
 
168
  function init() {
169
- add_filter('qlwcdc_add_sections', array($this, 'add_section'));
170
- add_filter('qlwcdc_add_fields', array($this, 'add_fields'));
 
 
171
  add_filter('woocommerce_get_script_data', array($this, 'add_to_cart_params'));
172
  add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'));
173
  add_filter('woocommerce_add_to_cart_redirect', array($this, 'add_to_cart_redirect'));
1
  <?php
 
2
  if (!defined('ABSPATH')) {
3
  die('-1');
4
  }
17
  return self::$instance;
18
  }
19
 
20
+ function add_header() {
 
 
 
 
 
 
 
 
21
  global $current_section;
22
+ ?>
23
+ <li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . QLWCDC_PREFIX . '&section'); ?>" class="<?php echo ( $current_section == '' ? 'current' : '' ); ?>"><?php esc_html_e('General', 'woocommerce-direct-checkout'); ?></a> | </li>
24
+ <?php
25
+ }
26
 
27
+ function get_settings() {
28
 
29
+ return array(
30
+ array(
31
+ 'name' => esc_html__('General', 'woocommerce-direct-checkout'),
32
+ 'type' => 'title',
33
+ 'desc' => esc_html__('Simplifies the checkout process.', 'woocommerce-direct-checkout'),
34
+ 'id' => 'qlwcdc_section_title'
35
+ ),
36
+ array(
37
+ 'name' => esc_html__('Added to cart alert', 'woocommerce-direct-checkout'),
38
+ 'desc_tip' => esc_html__('Replace "View Cart" alert with direct checkout.', 'woocommerce-direct-checkout'),
39
+ 'id' => 'qlwcdc_add_to_cart_message',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  'type' => 'select',
41
+ 'class' => 'chosen_select',
42
  'options' => array(
43
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
44
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
45
  ),
46
  'default' => 'no',
47
+ ),
48
+ array(
49
+ 'name' => esc_html__('Added to cart link', 'woocommerce-direct-checkout'),
50
+ 'desc_tip' => esc_html__('Replace "View Cart" link with direct checkout.', 'woocommerce-direct-checkout'),
51
+ 'id' => 'qlwcdc_add_to_cart_link',
52
+ 'type' => 'select',
53
+ 'class' => 'chosen_select',
54
+ 'options' => array(
55
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
56
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
57
+ ),
58
+ 'default' => 'no',
59
+ ),
60
+ array(
61
+ 'name' => esc_html__('Added to cart redirect', 'woocommerce-direct-checkout'),
62
+ 'desc_tip' => esc_html__('Add to cart button behaviour.', 'woocommerce-direct-checkout'),
63
+ 'id' => 'qlwcdc_add_to_cart',
64
  'type' => 'select',
65
  'class' => 'chosen_select',
66
  'options' => array(
67
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
68
+ //'ajax' => esc_html__('Ajax', 'woocommerce-direct-checkout'),
69
+ 'redirect' => esc_html__('Yes', 'woocommerce-direct-checkout'),
70
  ),
71
+ 'default' => 'no',
72
+ ),
73
+ /* 'add_to_cart_ajax_button' => array(
74
+ 'name' => esc_html__('Added to cart button', 'woocommerce-direct-checkout'),
75
+ 'desc_tip' => esc_html__('Show or hide the added to cart forward button.', 'woocommerce-direct-checkout'),
76
+ 'id' => 'qlwcdc_add_to_cart_ajax_button',
77
+ 'type' => 'select',
78
+ 'options' => array(
79
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
80
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
 
 
 
 
81
  ),
82
+ 'default' => 'no',
83
+ ), */
84
+ /* 'add_to_cart_ajax_message' => array(
85
+ 'name' => esc_html__('Added to cart alert', 'woocommerce-direct-checkout'),
86
+ 'desc_tip' => esc_html__('Include the "added to cart" alert message in product archives and shop.', 'woocommerce-direct-checkout'),
87
+ 'id' => 'qlwcdc_add_to_cart_ajax_message',
88
+ 'type' => 'select',
89
+ 'class' => 'chosen_select',
90
+ 'options' => array(
91
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
92
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
93
  ),
94
+ 'default' => 'yes',
95
+ ), */
96
+ array(
97
+ 'name' => esc_html__('Added to cart redirect to', 'woocommerce-direct-checkout'),
98
+ 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
99
+ 'id' => 'qlwcdc_add_to_cart_redirect_page',
100
+ 'type' => 'select',
101
+ 'class' => 'chosen_select',
102
+ 'options' => array(
103
+ 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
104
+ 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
105
+ 'url' => esc_html__('Custom URL', 'woocommerce-direct-checkout'),
106
+ ),
107
+ 'default' => 'cart',
108
+ ),
109
+ array(
110
+ 'name' => esc_html__('Added to cart redirect to custom url', 'woocommerce-direct-checkout'),
111
+ 'desc_tip' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
112
+ 'id' => 'qlwcdc_add_to_cart_redirect_url',
113
+ 'type' => 'text',
114
+ 'placeholder' => wc_get_checkout_url(),
115
+ ),
116
+ array(
117
+ 'type' => 'sectionend',
118
+ 'id' => 'qlwcdc_section_end'
119
+ )
120
+ );
121
+ }
122
+
123
+ function add_section() {
124
+
125
+ global $current_section;
126
+
127
+ if ('' == $current_section) {
128
+
129
+ $settings = $this->get_settings();
130
+
131
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/pages/general.php' );
132
  }
133
+ }
134
+
135
+ function save_settings() {
136
+
137
+ global $current_section;
138
+
139
+ if ('' == $current_section) {
140
 
141
+ woocommerce_update_options($this->get_settings());
142
+ }
143
  }
144
 
145
  function add_to_cart_params($params) {
180
  }
181
 
182
  function init() {
183
+ add_action('qlwcdc_sections_header', array($this, 'add_header'));
184
+ add_action('woocommerce_sections_' . QLWCDC_PREFIX, array($this, 'add_section'), 99);
185
+ add_action('woocommerce_settings_save_' . QLWCDC_PREFIX, array($this, 'save_settings'));
186
+
187
  add_filter('woocommerce_get_script_data', array($this, 'add_to_cart_params'));
188
  add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'));
189
  add_filter('woocommerce_add_to_cart_redirect', array($this, 'add_to_cart_redirect'));
includes/pages/archives.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php include_once('parts/tabs.php' ); ?>
2
+ <?php woocommerce_admin_fields($settings); ?>
includes/pages/checkout.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php include_once('parts/tabs.php' ); ?>
2
+ <?php woocommerce_admin_fields($settings); ?>
includes/pages/general.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php include_once('parts/tabs.php' ); ?>
2
+ <?php woocommerce_admin_fields($settings); ?>
includes/pages/parts/header.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap about-wrap full-width-layout">
2
+
3
+ <h1><?php esc_html_e('Suggestions', 'woocommerce-direct-checkout'); ?></h1>
4
+
5
+ <p class="about-text"><?php printf(esc_html__('Thanks for using our product! We recommend these extensions that will add new features to stand out your business and improve your sales.', 'woocommerce-direct-checkout'), QLWCDC_PLUGIN_NAME); ?></p>
6
+
7
+ <p class="about-text">
8
+ <?php printf('<a href="%s" target="_blank">%s</a>', QLWCDC_PURCHASE_URL, esc_html__('Purchase', 'woocommerce-direct-checkout')); ?></a> |
9
+ <?php printf('<a href="%s" target="_blank">%s</a>', QLWCDC_DOCUMENTATION_URL, esc_html__('Documentation', 'woocommerce-direct-checkout')); ?></a>
10
+ </p>
11
+
12
+ <?php printf('<a href="%s" target="_blank"><div style="
13
+ background: #006bff url(%s) no-repeat;
14
+ background-position: top center;
15
+ background-size: 130px 130px;
16
+ color: #fff;
17
+ font-size: 14px;
18
+ text-align: center;
19
+ font-weight: 600;
20
+ margin: 5px 0 0;
21
+ padding-top: 120px;
22
+ height: 40px;
23
+ display: inline-block;
24
+ width: 140px;
25
+ " class="wp-badge">%s</div></a>', 'https://quadlayers.com/?utm_source=qlwapp_admin', plugins_url('/assets/backend/img/quadlayers.jpg', QLWCDC_PLUGIN_FILE), esc_html__('QuadLayers', 'woocommerce-direct-checkout')); ?>
26
+
27
+ </div>
28
+
29
+ <?php
30
+ if (isset($GLOBALS['submenu'][QLWCDC_PREFIX])) {
31
+ if (is_array($GLOBALS['submenu'][QLWCDC_PREFIX])) {
32
+ ?>
33
+ <div class="wrap about-wrap full-width-layout qlwrap">
34
+ <h2 class="nav-tab-wrapper">
35
+ <?php
36
+ foreach ($GLOBALS['submenu'][QLWCDC_PREFIX] as $tab) {
37
+ if (strpos($tab[2], '.php') !== false)
38
+ continue;
39
+ ?>
40
+ <a href="<?php echo admin_url('admin.php?page=' . esc_attr($tab[2])); ?>" class="nav-tab<?php echo (isset($_GET['page']) && $_GET['page'] == $tab[2]) ? ' nav-tab-active' : ''; ?>"><?php echo $tab[0]; ?></a>
41
+ <?php
42
+ }
43
+ ?>
44
+ </h2>
45
+ </div>
46
+ <?php
47
+ }
48
+ }
includes/pages/parts/tabs.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <ul class="subsubsub">
2
+ <?php do_action('qlwcdc_sections_header'); ?>
3
+ <li><a target="_blank" href="<?php echo QLWCDC_DOCUMENTATION_URL; ?>"><?php echo esc_html__('Documentation', 'woocommerce-direct-checkout'); ?></a></li> |
4
+ <li><a href="<?php echo admin_url('admin.php?page=' . QLWCDC_PREFIX); ?>"><?php echo esc_html__('Premium', 'woocommerce-direct-checkout'); ?></a></li>
5
+ </ul>
6
+ <br class="clear" />
includes/pages/premium.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php include_once('parts/header.php' ); ?>
2
+ <div class="wrap about-wrap full-width-layout">
3
+ <div class="has-2-columns is-wider-left" style="max-width: 100%">
4
+ <div class="column">
5
+ <div class="welcome-header">
6
+ <h1><?php esc_html_e('Premium', 'woocommerce-direct-checkout'); ?></h1>
7
+ <div class="about-description">
8
+ <?php printf(esc_html__('%s allows you to simplifies the checkout process by skipping the shopping cart page. This plugin allows you to redirect your customers directly to the checkout page and includes the cart inside the checkout page.', 'woocommerce-direct-checkout'), QLWCDC_PLUGIN_NAME); ?>
9
+ </div>
10
+ <br/>
11
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url(QLWCDC_PURCHASE_URL); ?>"><?php esc_html_e('Purchase Now', 'woocommerce-direct-checkout'); ?></a>
12
+ <a class="button button-secondary" target="_blank" href="<?php echo esc_url(QLWCDC_SUPPORT_URL); ?>"><?php esc_html_e('Get Support', 'woocommerce-direct-checkout'); ?></a>
13
+ </div>
14
+ <hr/>
15
+ <div class="feature-section" style="padding: 10px 0;">
16
+ <h3><?php esc_html_e('One page checkout', 'woocommerce-direct-checkout'); ?></h3>
17
+ <p>
18
+ <?php printf(esc_html__('%s allows you to include the cart form in the checkout page allowing your users to edit the cart and confirm the order on the same page.', 'woocommerce-direct-checkout'), QLWCDC_PLUGIN_NAME); ?>
19
+ </p>
20
+ </div>
21
+ <div class="feature-section" style="padding: 10px 0;">
22
+ <h3><?php esc_html_e('Remove checkout fields', 'woocommerce-direct-checkout'); ?></h3>
23
+ <p>
24
+ <?php esc_html_e('Our checkout settings allow you to easily remove the unnecessary fields and reduce the user spend completing those fields like the order comments, shipping address, coupon form, policy text, and terms and conditions.', 'woocommerce-direct-checkout'); ?>
25
+ </p>
26
+ </div>
27
+ <div class="feature-section" style="padding: 10px 0;">
28
+ <h3><?php esc_html_e('Remove checkout columns', 'woocommerce-direct-checkout'); ?></h3>
29
+ <p>
30
+ <?php esc_html_e('This option allows you to simplify the checkout page by removing the two columns in the checkout page.', 'woocommerce-direct-checkout'); ?>
31
+ </p>
32
+ </div>
33
+ </div>
34
+ <div class="column">
35
+ <img src="<?php echo plugins_url('/assets/backend/img/checkout.png', QLWCDC_PLUGIN_FILE); ?>">
36
+ </div>
37
+ </div>
38
+ <hr/>
39
+ <div class="has-2-columns is-wider-left" style="max-width: 100%">
40
+ <div class="column">
41
+ <div class="feature-section" style="padding: 10px 0;">
42
+ <h3><?php esc_html_e('Checkout redirect', 'woocommerce-direct-checkout'); ?></h3>
43
+ <p>
44
+ <?php esc_html_e('This option allows you to redirect your users directly to the checkout page reducing the total checkout process in one step.', 'woocommerce-direct-checkout'); ?>
45
+ </p>
46
+ </div>
47
+ <div class="feature-section" style="padding: 10px 0;">
48
+ <h3><?php esc_html_e('Quick purchase on single products', 'woocommerce-direct-checkout'); ?></h3>
49
+ <p>
50
+ <?php esc_html_e('If you want to give the option to the user to make a direct purchase or the default add to cart product you can include a direct purchase button to the products page.', 'woocommerce-direct-checkout'); ?>
51
+ </p>
52
+ </div>
53
+ <div class="feature-section" style="padding: 10px 0;">
54
+ <h3><?php esc_html_e('Quick view in product archives', 'woocommerce-direct-checkout'); ?></h3>
55
+ <p>
56
+ <?php esc_html_e('This option allows you to include a button which displays a quick view in the WooCommerce shop page and products categories.', 'woocommerce-direct-checkout'); ?>
57
+ </p>
58
+ <p>
59
+ <?php esc_html_e('This is especially useful for the variable products because it allows users to select the products attributes and include directly into the cart.', 'woocommerce-direct-checkout'); ?>
60
+ </p>
61
+ </div>
62
+ <div class="feature-section" style="padding: 10px 0;">
63
+ <hr/>
64
+ <h3><?php esc_html_e('Quick purchase', 'woocommerce-direct-checkout'); ?></h3>
65
+ <p>
66
+ <?php esc_html_e('The Quick purchase button allows you to include a direct button in the single products, variable, grouped and virtual products wich redirects user to the checkout page.', 'woocommerce-direct-checkout'); ?>
67
+ </p>
68
+ </div>
69
+ </div>
70
+ <div class="column">
71
+ <br/>
72
+ <img src="<?php echo plugins_url('/assets/backend/img/modal.png', QLWCDC_PLUGIN_FILE); ?>">
73
+ </div>
74
+ </div>
75
+ </div>
includes/pages/products.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php include_once('parts/tabs.php' ); ?>
2
+ <?php woocommerce_admin_fields($settings); ?>
includes/pages/suggestions.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php include_once('parts/header.php' ); ?>
2
+ <div class="wrap" style="
3
+ position: relative;
4
+ margin: 25px 40px 0 20px;
5
+ max-width: 1200px;">
6
+ <?php
7
+ $wp_list_table = new QLWCDC_Suggestions_List_Table();
8
+ $wp_list_table->prepare_items();
9
+ ?>
10
+ <form id="plugin-filter" method="post" class="importer-item">
11
+ <?php $wp_list_table->display(); ?>
12
+ </form>
13
+ </div>
includes/premium.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class QLWCDC_Premium {
4
+
5
+ protected static $_instance;
6
+
7
+ public function __construct() {
8
+ $this->init();
9
+ }
10
+
11
+ public static function instance() {
12
+ if (is_null(self::$_instance)) {
13
+ self::$_instance = new self();
14
+ }
15
+ return self::$_instance;
16
+ }
17
+
18
+ function remove_menu() {
19
+ ?>
20
+ <style>
21
+
22
+ li.toplevel_page_qlwcdc {
23
+ display:none;
24
+ }
25
+
26
+ </style>
27
+ <?php
28
+
29
+ }
30
+
31
+ // Admin
32
+ // -------------------------------------------------------------------------
33
+
34
+ public function add_page() {
35
+ include_once( QLWCDC_PLUGIN_DIR . '/includes/pages/premium.php' );
36
+ }
37
+
38
+ function add_menu() {
39
+ add_menu_page(QLWCDC_PLUGIN_NAME, QLWCDC_PLUGIN_NAME, 'manage_woocommerce', QLWCDC_PREFIX, array($this, 'add_page'));
40
+ add_submenu_page(QLWCDC_PREFIX, esc_html__('Premium', 'woocommerce-checkout-manager'), esc_html__('Premium', 'woocommerce-checkout-manager'), 'manage_woocommerce', QLWCDC_PREFIX, array($this, 'add_page'));
41
+ }
42
+
43
+ public function init() {
44
+ add_action('admin_menu', array($this, 'add_menu'));
45
+ add_action('admin_head', array($this, 'remove_menu'));
46
+ }
47
+
48
+ }
49
+
50
+ QLWCDC_Premium::instance();
includes/products.php CHANGED
@@ -10,114 +10,129 @@ if (!class_exists('QLWCDC_Products')) {
10
  protected static $instance;
11
  var $product_fields;
12
 
13
- function add_section($sections = array()) {
 
 
 
 
 
14
 
15
- $sections['products'] = esc_html__('Products', 'woocommerce-direct-checkout');
16
 
17
- return $sections;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
- function add_fields($fields) {
21
 
22
  global $current_section;
23
 
24
  if ('products' == $current_section) {
25
 
26
- $fields = array(
27
- 'section_title' => array(
28
- 'name' => esc_html__('Products', 'woocommerce-direct-checkout'),
29
- 'type' => 'title',
30
- 'id' => 'qlwcdc_products_section_title'
31
- ),
32
- 'add_product_ajax' => array(
33
- 'name' => esc_html__('Add ajax add to cart', 'woocommerce-direct-checkout'),
34
- 'desc_tip' => esc_html__('Add products to cart via ajax.', 'woocommerce-direct-checkout'),
35
- 'id' => 'qlwcdc_add_product_ajax',
36
- 'type' => 'select',
37
- 'class' => 'chosen_select qlwcdc-premium-field',
38
- 'options' => array(
39
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
40
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
41
- ),
42
- 'default' => 'no',
43
- ),
44
- 'add_product_text' => array(
45
- 'name' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
46
- 'desc_tip' => esc_html__('Replace "Add to cart" text.', 'woocommerce-direct-checkout'),
47
- 'id' => 'qlwcdc_add_product_text',
48
- 'type' => 'select',
49
- 'class' => 'chosen_select',
50
- 'options' => array(
51
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
52
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
53
- ),
54
- 'default' => 'no',
55
- ),
56
- 'add_product_text_content' => array(
57
- 'name' => esc_html__('Replace Add to cart text content', 'woocommerce-direct-checkout'),
58
- 'desc_tip' => esc_html__('Replace "Add to cart" text with this text.', 'woocommerce-direct-checkout'),
59
- 'id' => 'qlwcdc_add_product_text_content',
60
- 'type' => 'text',
61
- 'default' => esc_html__('Purchase', 'woocommerce-direct-checkout')
62
- ),
63
- 'add_product_quick_purchase' => array(
64
- 'name' => esc_html__('Add quick purchase button', 'woocommerce-direct-checkout'),
65
- 'desc_tip' => esc_html__('Add a quick purchase button to the products pages.', 'woocommerce-direct-checkout'),
66
- 'id' => 'qlwcdc_add_product_quick_purchase',
67
- 'type' => 'select',
68
- 'class' => 'chosen_select',
69
- 'options' => array(
70
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
71
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
72
- ),
73
- 'default' => 'no',
74
- ),
75
- 'add_product_quick_purchase_class' => array(
76
- 'name' => esc_html__('Add quick purchase class', 'woocommerce-direct-checkout'),
77
- 'desc_tip' => esc_html__('Add a custom class to the quick purchase button.', 'woocommerce-direct-checkout'),
78
- 'id' => 'qlwcdc_add_product_quick_purchase_class',
79
- 'type' => 'text',
80
- 'default' => ''
81
- ),
82
- 'add_product_quick_purchase_to' => array(
83
- 'name' => esc_html__('Redirect quick purchase to', 'woocommerce-direct-checkout'),
84
- 'desc_tip' => esc_html__('Redirect the quick purchase button to the cart or checkout page.', 'woocommerce-direct-checkout'),
85
- 'id' => 'qlwcdc_add_product_quick_purchase_to',
86
- 'type' => 'select',
87
- 'class' => 'chosen_select',
88
- 'options' => array(
89
- 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
90
- 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
91
- ),
92
- 'default' => 'checkout',
93
- ),
94
- 'add_product_quick_purchase_text' => array(
95
- 'name' => esc_html__('Add quick purchase text', 'woocommerce-direct-checkout'),
96
- 'desc_tip' => esc_html__('Add a custom text to the quick purchase button.', 'woocommerce-direct-checkout'),
97
- 'id' => 'qlwcdc_add_product_quick_purchase_text',
98
- 'type' => 'text',
99
- 'default' => esc_html__('Purchase Now', 'woocommerce-direct-checkout')
100
- ),
101
- 'add_product_default_attributes' => array(
102
- 'name' => esc_html__('Add default attributes in variable products', 'woocommerce-direct-checkout'),
103
- 'desc_tip' => esc_html__('Add default attributes in all variable products to avoid disabled Add to cart button.', 'woocommerce-direct-checkout'),
104
- 'id' => 'qlwcdc_add_product_default_attributes',
105
- 'type' => 'select',
106
- 'class' => 'chosen_select',
107
- 'options' => array(
108
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
109
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
110
- ),
111
- 'default' => 'no',
112
- ),
113
- 'section_end' => array(
114
- 'type' => 'sectionend',
115
- 'id' => 'qlwcdc_products_section_end'
116
- )
117
- );
118
  }
 
 
 
 
 
119
 
120
- return $fields;
 
 
 
121
  }
122
 
123
  function add_product_fields() {
@@ -128,68 +143,7 @@ if (!class_exists('QLWCDC_Products')) {
128
  return;
129
 
130
  // Fields
131
- $this->product_fields = array(
132
- /* 'start_group',
133
- array(
134
- 'label' => esc_html__('Add to cart', 'woocommerce-direct-checkout'),
135
- 'desc_tip' => true,
136
- 'description' => esc_html__('Add to cart behaviour for this product.', 'woocommerce-direct-checkout'),
137
- 'id' => 'qlwcdc_add_product_cart',
138
- 'type' => 'select',
139
- 'options' => array(
140
- 'no' => esc_html__('Reload', 'woocommerce-direct-checkout'),
141
- 'ajax' => esc_html__('Ajax', 'woocommerce-direct-checkout'),
142
- 'redirect' => esc_html__('Redirect', 'woocommerce-direct-checkout'),
143
- ),
144
- 'value' => $this->get_product_option($thepostid, 'qlwcdc_add_product_cart', 'no'),
145
- ),
146
- array(
147
- 'label' => esc_html__('Ajax added to cart button', 'woocommerce-direct-checkout'),
148
- 'desc_tip' => true,
149
- 'description' => esc_html__('Display ajax added to cart button.', 'woocommerce-direct-checkout'),
150
- 'id' => 'qlwcdc_add_product_cart_ajax_button',
151
- 'type' => 'select',
152
- 'options' => array(
153
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
154
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
155
- ),
156
- 'value' => $this->get_product_option($thepostid, 'qlwcdc_add_product_cart_ajax_button', 'no'),
157
- ),
158
- array(
159
- 'label' => esc_html__('Ajax added to cart alert', 'woocommerce-direct-checkout'),
160
- 'desc_tip' => true,
161
- 'description' => esc_html__('Display ajax added to cart alert for this product.', 'woocommerce-direct-checkout'),
162
- 'id' => 'qlwcdc_add_product_cart_ajax_message',
163
- 'type' => 'select',
164
- 'options' => array(
165
- 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
166
- 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
167
- ),
168
- 'value' => $this->get_product_option($thepostid, 'qlwcdc_add_product_cart_ajax_message', 'no'),
169
- ),
170
- array(
171
- 'label' => esc_html__('Added to cart redirect to', 'woocommerce-direct-checkout'),
172
- 'desc_tip' => true,
173
- 'description' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
174
- 'id' => 'qlwcdc_add_product_cart_redirect_page',
175
- 'type' => 'select',
176
- 'options' => array(
177
- 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
178
- 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
179
- 'url' => esc_html__('Custom URL', 'woocommerce-direct-checkout'),
180
- ),
181
- 'value' => $this->get_product_option($thepostid, 'qlwcdc_add_product_cart_redirect_page', 'cart'),
182
- ),
183
- array(
184
- 'label' => esc_html__('Added to cart redirect to custom url', 'woocommerce-direct-checkout'),
185
- 'desc_tip' => true,
186
- 'description' => esc_html__('Redirect to the cart or checkout page after successful addition.', 'woocommerce-direct-checkout'),
187
- 'id' => 'qlwcdc_add_product_cart_redirect_url',
188
- 'type' => 'text',
189
- 'placeholder' => get_option('qlwcdc_add_product_cart_redirect_url'),
190
- 'value' => $this->get_product_option($thepostid, 'qlwcdc_add_product_cart_redirect_url'),
191
- ),
192
- 'end_group', */
193
  'start_group',
194
  array(
195
  'label' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
@@ -263,7 +217,7 @@ if (!class_exists('QLWCDC_Products')) {
263
 
264
  function add_product_tabs($tabs) {
265
 
266
- $tabs[QLWCDC_DOMAIN] = array(
267
  'label' => esc_html__('Direct Checkout', 'woocommerce-direct-checkout'),
268
  'target' => 'qlwcdc_options',
269
  );
@@ -305,36 +259,6 @@ if (!class_exists('QLWCDC_Products')) {
305
  <?php
306
  }
307
 
308
- /* function added_to_cart_message_js() {
309
-
310
- global $product;
311
-
312
- if ('ajax' === $this->get_product_option($product->get_id(), 'qlwcdc_add_product_cart', 'no') && 'yes' === $this->get_product_option($product->get_id(), 'qlwcdc_add_product_cart_ajax_message', 'yes')) {
313
- ?>
314
- <script>
315
- (function ($) {
316
- $(document).bind('added_to_cart', function (e, cart) {
317
- $(document.body).trigger('added_to_cart_message', [e, cart]);
318
- });
319
- })(jQuery);
320
- </script>
321
- <?php
322
- }
323
- if ('redirect' === $this->get_product_option($product->get_id(), 'qlwcdc_add_product_cart', 'no')) {
324
- ?>
325
- <script>
326
- (function ($) {
327
- $(document).bind('added_to_cart', function (e, cart) {
328
- if (wc_add_to_cart_params.cart_url !== undefined) {
329
- window.location = wc_add_to_cart_params.cart_url;
330
- }
331
- });
332
- })(jQuery);
333
- </script>
334
- <?php
335
- }
336
- } */
337
-
338
  function add_product_text($text, $product) {
339
 
340
  if ('yes' === $this->get_product_option($product->get_id(), 'qlwcdc_add_product_text')) {
@@ -342,25 +266,7 @@ if (!class_exists('QLWCDC_Products')) {
342
  }
343
 
344
  return $text;
345
- }
346
-
347
- /* function add_to_cart_class($class) {
348
-
349
- if (is_product() && get_option('qlwcdc_add_product_ajax')) {
350
- $class = str_replace(' add_to_cart_button', ' single_add_to_cart_button', $class);
351
- $class = str_replace('add_to_cart_button ', 'single_add_to_cart_button ', $class);
352
- $class = str_replace(' ajax_add_to_cart', '', $class);
353
- $class = str_replace('ajax_add_to_cart ', ' ', $class);
354
- }
355
-
356
- return $class;
357
- } */
358
-
359
- /* function add_storefront_notices() {
360
- if (is_product() && 'yes' === $this->get_product_option(get_queried_object_id(), 'qlwcdc_add_product_cart_ajax_message', 'no')) {
361
- woocommerce_output_all_notices();
362
- }
363
- } */
364
 
365
  function validate_add_cart_item($passed, $product_id, $qty, $post_data = null) {
366
 
@@ -386,16 +292,12 @@ if (!class_exists('QLWCDC_Products')) {
386
  }
387
 
388
  function init() {
389
- add_filter('qlwcdc_add_sections', array($this, 'add_section'));
390
- add_filter('qlwcdc_add_fields', array($this, 'add_fields'));
391
- //add_filter('woocommerce_add_to_cart_redirect', array($this, 'add_to_cart_redirect'));
392
- //add_filter('woocommerce_before_single_product', array($this, 'added_to_cart_button'));
393
- //add_filter('woocommerce_after_single_product', array($this, 'added_to_cart_message_js'));
394
  add_filter('woocommerce_product_data_tabs', array($this, 'add_product_tabs'));
395
  add_action('woocommerce_product_data_panels', array($this, 'add_product_tab_content'));
396
  add_filter('woocommerce_product_single_add_to_cart_text', array($this, 'add_product_text'), 10, 2);
397
- //add_filter('add_to_cart_class', array($this, 'add_to_cart_class'));
398
- //add_action('storefront_content_top', array($this, 'add_storefront_notices'));
399
  // WooCommerce Product Addon Compatibility
400
  add_filter('woocommerce_add_to_cart_validation', array($this, 'validate_add_cart_item'), -10, 4);
401
  }
10
  protected static $instance;
11
  var $product_fields;
12
 
13
+ function add_header() {
14
+ global $current_section;
15
+ ?>
16
+ <li><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=' . QLWCDC_PREFIX . '&section=products'); ?>" class="<?php echo ( $current_section == 'products' ? 'current' : '' ); ?>"><?php esc_html_e('Products', 'woocommerce-direct-checkout'); ?></a> | </li>
17
+ <?php
18
+ }
19
 
20
+ function get_settings() {
21
 
22
+ return array(
23
+ array(
24
+ 'name' => esc_html__('Products', 'woocommerce-direct-checkout'),
25
+ 'type' => 'title',
26
+ 'id' => 'qlwcdc_products_section_title'
27
+ ),
28
+ array(
29
+ 'name' => esc_html__('Add ajax add to cart', 'woocommerce-direct-checkout'),
30
+ 'desc_tip' => esc_html__('Add products to cart via ajax.', 'woocommerce-direct-checkout'),
31
+ 'id' => 'qlwcdc_add_product_ajax',
32
+ 'type' => 'select',
33
+ 'class' => 'chosen_select qlwcdc-premium-field',
34
+ 'options' => array(
35
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
36
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
37
+ ),
38
+ 'default' => 'no',
39
+ ),
40
+ array(
41
+ 'name' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
42
+ 'desc_tip' => esc_html__('Replace "Add to cart" text.', 'woocommerce-direct-checkout'),
43
+ 'id' => 'qlwcdc_add_product_text',
44
+ 'type' => 'select',
45
+ 'class' => 'chosen_select',
46
+ 'options' => array(
47
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
48
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
49
+ ),
50
+ 'default' => 'no',
51
+ ),
52
+ array(
53
+ 'name' => esc_html__('Replace Add to cart text content', 'woocommerce-direct-checkout'),
54
+ 'desc_tip' => esc_html__('Replace "Add to cart" text with this text.', 'woocommerce-direct-checkout'),
55
+ 'id' => 'qlwcdc_add_product_text_content',
56
+ 'type' => 'text',
57
+ 'default' => esc_html__('Purchase', 'woocommerce-direct-checkout')
58
+ ),
59
+ array(
60
+ 'name' => esc_html__('Add quick purchase button', 'woocommerce-direct-checkout'),
61
+ 'desc_tip' => esc_html__('Add a quick purchase button to the products pages.', 'woocommerce-direct-checkout'),
62
+ 'id' => 'qlwcdc_add_product_quick_purchase',
63
+ 'type' => 'select',
64
+ 'class' => 'chosen_select',
65
+ 'options' => array(
66
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
67
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
68
+ ),
69
+ 'default' => 'no',
70
+ ),
71
+ array(
72
+ 'name' => esc_html__('Add quick purchase class', 'woocommerce-direct-checkout'),
73
+ 'desc_tip' => esc_html__('Add a custom class to the quick purchase button.', 'woocommerce-direct-checkout'),
74
+ 'id' => 'qlwcdc_add_product_quick_purchase_class',
75
+ 'type' => 'text',
76
+ 'default' => ''
77
+ ),
78
+ array(
79
+ 'name' => esc_html__('Redirect quick purchase to', 'woocommerce-direct-checkout'),
80
+ 'desc_tip' => esc_html__('Redirect the quick purchase button to the cart or checkout page.', 'woocommerce-direct-checkout'),
81
+ 'id' => 'qlwcdc_add_product_quick_purchase_to',
82
+ 'type' => 'select',
83
+ 'class' => 'chosen_select',
84
+ 'options' => array(
85
+ 'cart' => esc_html__('Cart', 'woocommerce-direct-checkout'),
86
+ 'checkout' => esc_html__('Checkout', 'woocommerce-direct-checkout'),
87
+ ),
88
+ 'default' => 'checkout',
89
+ ),
90
+ array(
91
+ 'name' => esc_html__('Add quick purchase text', 'woocommerce-direct-checkout'),
92
+ 'desc_tip' => esc_html__('Add a custom text to the quick purchase button.', 'woocommerce-direct-checkout'),
93
+ 'id' => 'qlwcdc_add_product_quick_purchase_text',
94
+ 'type' => 'text',
95
+ 'default' => esc_html__('Purchase Now', 'woocommerce-direct-checkout')
96
+ ),
97
+ array(
98
+ 'name' => esc_html__('Add default attributes in variable products', 'woocommerce-direct-checkout'),
99
+ 'desc_tip' => esc_html__('Add default attributes in all variable products to avoid disabled Add to cart button.', 'woocommerce-direct-checkout'),
100
+ 'id' => 'qlwcdc_add_product_default_attributes',
101
+ 'type' => 'select',
102
+ 'class' => 'chosen_select',
103
+ 'options' => array(
104
+ 'yes' => esc_html__('Yes', 'woocommerce-direct-checkout'),
105
+ 'no' => esc_html__('No', 'woocommerce-direct-checkout'),
106
+ ),
107
+ 'default' => 'no',
108
+ ),
109
+ array(
110
+ 'type' => 'sectionend',
111
+ 'id' => 'qlwcdc_products_section_end'
112
+ )
113
+ );
114
  }
115
 
116
+ function add_section() {
117
 
118
  global $current_section;
119
 
120
  if ('products' == $current_section) {
121
 
122
+ $settings = $this->get_settings();
123
+
124
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/pages/products.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
+ }
127
+
128
+ function save_settings() {
129
+
130
+ global $current_section;
131
 
132
+ if ('products' == $current_section) {
133
+
134
+ woocommerce_update_options($this->get_settings());
135
+ }
136
  }
137
 
138
  function add_product_fields() {
143
  return;
144
 
145
  // Fields
146
+ $this->product_fields = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  'start_group',
148
  array(
149
  'label' => esc_html__('Replace Add to cart text', 'woocommerce-direct-checkout'),
217
 
218
  function add_product_tabs($tabs) {
219
 
220
+ $tabs[QLWCDC_PREFIX] = array(
221
  'label' => esc_html__('Direct Checkout', 'woocommerce-direct-checkout'),
222
  'target' => 'qlwcdc_options',
223
  );
259
  <?php
260
  }
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  function add_product_text($text, $product) {
263
 
264
  if ('yes' === $this->get_product_option($product->get_id(), 'qlwcdc_add_product_text')) {
266
  }
267
 
268
  return $text;
269
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
 
271
  function validate_add_cart_item($passed, $product_id, $qty, $post_data = null) {
272
 
292
  }
293
 
294
  function init() {
295
+ add_action('qlwcdc_sections_header', array($this, 'add_header'));
296
+ add_action('woocommerce_sections_' . QLWCDC_PREFIX, array($this, 'add_section'), 99);
297
+ add_action('woocommerce_settings_save_' . QLWCDC_PREFIX, array($this, 'save_settings'));
 
 
298
  add_filter('woocommerce_product_data_tabs', array($this, 'add_product_tabs'));
299
  add_action('woocommerce_product_data_panels', array($this, 'add_product_tab_content'));
300
  add_filter('woocommerce_product_single_add_to_cart_text', array($this, 'add_product_text'), 10, 2);
 
 
301
  // WooCommerce Product Addon Compatibility
302
  add_filter('woocommerce_add_to_cart_validation', array($this, 'validate_add_cart_item'), -10, 4);
303
  }
includes/purchase.php DELETED
@@ -1,120 +0,0 @@
1
- <?php
2
- if (!defined('ABSPATH')) {
3
- die('-1');
4
- }
5
-
6
- if (!class_exists('QLWCDC_Purchase')) {
7
-
8
- class QLWCDC_Purchase {
9
-
10
- protected static $instance;
11
-
12
- function add_section($sections) {
13
-
14
- $sections['premium'] = esc_html__('Premium', 'woocommerce-direct-checkout');
15
-
16
- return $sections;
17
- }
18
-
19
- function add_page() {
20
-
21
- global $current_section, $hide_save_button;
22
-
23
- if ('premium' == $current_section) {
24
- $hide_save_button = true;
25
- ?>
26
- <div class="wrap about-wrap full-width-layout qlwrap">
27
- <div class="has-2-columns is-wider-left" style="max-width: 100%">
28
- <div class="column">
29
- <div class="welcome-header">
30
- <h1><?php esc_html_e('Premium', 'woocommerce-direct-checkout'); ?></h1>
31
- <div class="about-description">
32
- <?php printf(esc_html__('%s allows you to simplifies the checkout process by skipping the shopping cart page. This plugin allows you to redirect your customers directly to the checkout page and includes the cart inside the checkout page.', 'woocommerce-direct-checkout'), QLWCDC_PLUGIN_NAME); ?>
33
- </div>
34
- <br/>
35
- <a class="button button-primary" target="_blank" href="<?php echo esc_url(QLWCDC_PURCHASE_URL); ?>"><?php esc_html_e('Purchase Now', 'woocommerce-direct-checkout'); ?></a>
36
- <a class="button button-secondary" target="_blank" href="<?php echo esc_url(QLWCDC_SUPPORT_URL); ?>"><?php esc_html_e('Get Support', 'woocommerce-direct-checkout'); ?></a>
37
- </div>
38
- <hr/>
39
- <div class="feature-section" style="padding: 10px 0;">
40
- <h3><?php esc_html_e('One page checkout', 'woocommerce-direct-checkout'); ?></h3>
41
- <p>
42
- <?php printf(esc_html__('%s allows you to include the cart form in the checkout page allowing your users to edit the cart and confirm the order on the same page.', 'woocommerce-direct-checkout'), QLWCDC_PLUGIN_NAME); ?>
43
- </p>
44
- </div>
45
- <div class="feature-section" style="padding: 10px 0;">
46
- <h3><?php esc_html_e('Remove checkout fields', 'woocommerce-direct-checkout'); ?></h3>
47
- <p>
48
- <?php esc_html_e('Our checkout settings allow you to easily remove the unnecessary fields and reduce the user spend completing those fields like the order comments, shipping address, coupon form, policy text, and terms and conditions.', 'woocommerce-direct-checkout'); ?>
49
- </p>
50
- </div>
51
- <div class="feature-section" style="padding: 10px 0;">
52
- <h3><?php esc_html_e('Remove checkout columns', 'woocommerce-direct-checkout'); ?></h3>
53
- <p>
54
- <?php esc_html_e('This option allows you to simplify the checkout page by removing the two columns in the checkout page.', 'woocommerce-direct-checkout'); ?>
55
- </p>
56
- </div>
57
- </div>
58
- <div class="column">
59
- <img src="<?php echo plugins_url('/assets/backend/img/checkout.png', QLWCDC_PLUGIN_FILE); ?>">
60
- </div>
61
- </div>
62
- <hr/>
63
- <div class="has-2-columns is-wider-left" style="max-width: 100%">
64
- <div class="column">
65
- <div class="feature-section" style="padding: 10px 0;">
66
- <h3><?php esc_html_e('Checkout redirect', 'woocommerce-direct-checkout'); ?></h3>
67
- <p>
68
- <?php esc_html_e('This option allows you to redirect your users directly to the checkout page reducing the total checkout process in one step.', 'woocommerce-direct-checkout'); ?>
69
- </p>
70
- </div>
71
- <div class="feature-section" style="padding: 10px 0;">
72
- <h3><?php esc_html_e('Quick purchase on single products', 'woocommerce-direct-checkout'); ?></h3>
73
- <p>
74
- <?php esc_html_e('If you want to give the option to the user to make a direct purchase or the default add to cart product you can include a direct purchase button to the products page.', 'woocommerce-direct-checkout'); ?>
75
- </p>
76
- </div>
77
- <div class="feature-section" style="padding: 10px 0;">
78
- <h3><?php esc_html_e('Quick view in product archives', 'woocommerce-direct-checkout'); ?></h3>
79
- <p>
80
- <?php esc_html_e('This option allows you to include a button which displays a quick view in the WooCommerce shop page and products categories.', 'woocommerce-direct-checkout'); ?>
81
- </p>
82
- <p>
83
- <?php esc_html_e('This is especially useful for the variable products because it allows users to select the products attributes and include directly into the cart.', 'woocommerce-direct-checkout'); ?>
84
- </p>
85
- </div>
86
- <div class="feature-section" style="padding: 10px 0;">
87
- <hr/>
88
- <h3><?php esc_html_e('Quick purchase', 'woocommerce-direct-checkout'); ?></h3>
89
- <p>
90
- <?php esc_html_e('The Quick purchase button allows you to include a direct button in the single products, variable, grouped and virtual products wich redirects user to the checkout page.', 'woocommerce-direct-checkout'); ?>
91
- </p>
92
- </div>
93
- </div>
94
- <div class="column">
95
- <br/>
96
- <img src="<?php echo plugins_url('/assets/backend/img/modal.png', QLWCDC_PLUGIN_FILE); ?>">
97
- </div>
98
- </div>
99
- </div>
100
- <?php
101
- }
102
- }
103
-
104
- function init() {
105
- add_filter('qlwcdc_add_sections', array($this, 'add_section'));
106
- add_action('woocommerce_sections_qlwcdc', array($this, 'add_page'));
107
- }
108
-
109
- public static function instance() {
110
- if (!isset(self::$instance)) {
111
- self::$instance = new self();
112
- self::$instance->init();
113
- }
114
- return self::$instance;
115
- }
116
-
117
- }
118
-
119
- QLWCDC_Purchase::instance();
120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/suggestions-list-table.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-plugin-install-list-table.php' );
4
+
5
+ class QLWCDC_Suggestions_List_Table extends WP_Plugin_Install_List_Table {
6
+
7
+ public $promote = array(
8
+ 'wp-menu-icons',
9
+ 'wp-whatsapp-chat',
10
+ 'insta-gallery',
11
+ 'quadmenu',
12
+ 'woocommerce-checkout-manager',
13
+ 'woocommerce-direct-checkout',
14
+ );
15
+
16
+ private function remove_plugins($plugins) {
17
+
18
+ $promote = array();
19
+
20
+ foreach ($this->promote as $order => $slug) {
21
+
22
+ if ($id = @max(array_keys(array_column($plugins, 'slug'), $slug))) {
23
+
24
+ $promote[] = $plugins[$id];
25
+ }
26
+ }
27
+
28
+ return $promote;
29
+ }
30
+
31
+ public function self_admin_url($url, $path) {
32
+
33
+ if (strpos($url, 'tab=plugin-information') !== false) {
34
+ $url = network_admin_url($path);
35
+ }
36
+
37
+ return $url;
38
+ }
39
+
40
+ public function network_admin_url($url, $path) {
41
+
42
+ if (strpos($url, 'plugins.php') !== false) {
43
+ $url = self_admin_url($path);
44
+ }
45
+
46
+ return $url;
47
+ }
48
+
49
+ public function display_rows() {
50
+ add_filter('self_admin_url', array($this, 'self_admin_url'), 10, 2);
51
+ add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 2);
52
+ parent::display_rows();
53
+ }
54
+
55
+ public function is_connected() {
56
+
57
+ global $wp_version;
58
+
59
+ $http_args = array(
60
+ 'timeout' => 15,
61
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'),
62
+ );
63
+
64
+ return is_wp_error(wp_remote_get('http://api.wordpress.org/plugins/info/1.2/', $http_args));
65
+ }
66
+
67
+ public function get_plugins() {
68
+
69
+ $plugins = get_transient('ql_suggestions_plugins');
70
+
71
+ if ($plugins === false) {
72
+
73
+ $args = array(
74
+ 'per_page' => 36,
75
+ 'author' => 'quadlayers',
76
+ 'locale' => get_user_locale(),
77
+ );
78
+
79
+ $api = plugins_api('query_plugins', $args);
80
+
81
+ if (!is_wp_error($api)) {
82
+
83
+ $plugins = $this->remove_plugins($api->plugins);
84
+
85
+ set_transient('ql_suggestions_plugins', $plugins, 24 * HOUR_IN_SECONDS);
86
+ }
87
+ }
88
+
89
+ return $plugins;
90
+ }
91
+
92
+ public function prepare_items() {
93
+
94
+ include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
95
+
96
+ global $tabs, $tab;
97
+
98
+ wp_enqueue_style('thickbox');
99
+ wp_enqueue_script('plugin-install');
100
+ wp_enqueue_script('thickbox');
101
+ wp_enqueue_script('updates');
102
+
103
+ wp_reset_vars(array('tab'));
104
+
105
+ $tabs = array();
106
+
107
+ if ('search' === $tab) {
108
+ $tabs['search'] = __('Search Results');
109
+ }
110
+ if ($tab === 'beta' || false !== strpos(get_bloginfo('version'), '-')) {
111
+ $tabs['beta'] = _x('Beta Testing', 'Plugin Installer');
112
+ }
113
+ $tabs['featured'] = _x('Featured', 'Plugin Installer');
114
+ $tabs['popular'] = _x('Popular', 'Plugin Installer');
115
+ $tabs['recommended'] = _x('Recommended', 'Plugin Installer');
116
+ $tabs['favorites'] = _x('Favorites', 'Plugin Installer');
117
+
118
+ $nonmenu_tabs = array('plugin-information'); // Valid actions to perform which do not have a Menu item.
119
+
120
+ $tabs = apply_filters('install_plugins_tabs', $tabs);
121
+
122
+ $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
123
+
124
+ // If a non-valid menu tab has been selected, And it's not a non-menu action.
125
+ if (empty($tab) || (!isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs) )) {
126
+ $tab = key($tabs);
127
+ }
128
+
129
+ $this->items = $this->get_plugins();
130
+ }
131
+
132
+ }
includes/suggestions.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class QLWCDC_Suggestions {
4
+
5
+ protected static $_instance;
6
+
7
+ public function __construct() {
8
+ $this->init();
9
+ }
10
+
11
+ public static function instance() {
12
+ if (is_null(self::$_instance)) {
13
+ self::$_instance = new self();
14
+ }
15
+ return self::$_instance;
16
+ }
17
+
18
+ // Admin
19
+ // -------------------------------------------------------------------------
20
+
21
+ public function add_page() {
22
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/suggestions-list-table.php' );
23
+ include_once( QLWCDC_PLUGIN_DIR . 'includes/pages/suggestions.php' );
24
+ }
25
+
26
+ public function add_menu() {
27
+ add_submenu_page(QLWCDC_PREFIX, __('Suggestions', 'woocommerce-direct-checkout'), __('Suggestions', 'woocommerce-direct-checkout'), 'manage_woocommerce', QLWCDC_PREFIX . '_suggestions', array($this, 'add_page'));
28
+ }
29
+
30
+ // fix for activateUrl on install now button
31
+ public function network_admin_url($url, $path) {
32
+
33
+ if (wp_doing_ajax() && !is_network_admin()) {
34
+ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'install-plugin') {
35
+ if (strpos($url, 'plugins.php') !== false) {
36
+ $url = self_admin_url($path);
37
+ }
38
+ }
39
+ }
40
+
41
+ return $url;
42
+ }
43
+
44
+ public function add_redirect() {
45
+
46
+ if (isset($_REQUEST['activate']) && $_REQUEST['activate'] == 'true') {
47
+ if (wp_get_referer() == admin_url('admin.php?page=' . QLWCDC_PREFIX . '_suggestions')) {
48
+ wp_redirect(admin_url('admin.php?page=' . QLWCDC_PREFIX . '_suggestions'));
49
+ }
50
+ }
51
+ }
52
+
53
+ public function init() {
54
+ add_action('admin_menu', array($this, 'add_menu'));
55
+ add_action('admin_init', array($this, 'add_redirect'));
56
+ add_filter('network_admin_url', array($this, 'network_admin_url'), 10, 2);
57
+ }
58
+
59
+ }
60
+
61
+ QLWCDC_Suggestions::instance();
62
+
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.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -53,6 +53,9 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 2.2.6 =
57
  * Fix. WooCommerce Direct Checkout Premium compatibility
58
 
4
  Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
5
  Requires at least: 4.8
6
  Tested up to: 5.2.2
7
+ Stable tag: 2.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
53
 
54
  == Changelog ==
55
 
56
+ = 2.2.7 =
57
+ * Fix. WooCommerce Direct Checkout Premium compatibility
58
+
59
  = 2.2.6 =
60
  * Fix. WooCommerce Direct Checkout Premium compatibility
61
 
woocommerce-direct-checkout.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce Direct Checkout
4
  * Description: Simplifies the checkout process to improve your sales rate.
5
- * Version: 2.2.6
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.6');
19
  }
20
  if (!defined('QLWCDC_PLUGIN_FILE')) {
21
  define('QLWCDC_PLUGIN_FILE', __FILE__);
@@ -23,8 +23,11 @@ if (!defined('QLWCDC_PLUGIN_FILE')) {
23
  if (!defined('QLWCDC_PLUGIN_DIR')) {
24
  define('QLWCDC_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
25
  }
 
 
 
26
  if (!defined('QLWCDC_DOMAIN')) {
27
- define('QLWCDC_DOMAIN', 'qlwcdc');
28
  }
29
  if (!defined('QLWCDC_WORDPRESS_URL')) {
30
  define('QLWCDC_WORDPRESS_URL', 'https://wordpress.org/plugins/woocommerce-direct-checkout/');
@@ -141,60 +144,60 @@ if (!class_exists('QLWCDC')) {
141
  function add_action_links($links) {
142
 
143
  $links[] = '<a target="_blank" href="' . QLWCDC_PURCHASE_URL . '">' . esc_html__('Premium', 'woocommerce-direct-checkout') . '</a>';
144
- $links[] = '<a href="' . admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(QLWCDC_DOMAIN)) . '">' . esc_html__('Settings', 'woocommerce-direct-checkout') . '</a>';
145
 
146
  return $links;
147
  }
148
 
149
- function add_sections($sections = array()) {
150
-
151
- global $current_section;
152
-
153
- $sections = apply_filters('qlwcdc_add_sections', array());
154
-
155
- echo '<ul class="subsubsub">';
156
-
157
- $array_keys = array_keys($sections);
158
-
159
- foreach ($sections as $id => $label) {
160
- echo '<li><a href="' . admin_url('admin.php?page=wc-settings&tab=qlwcdc&section=' . sanitize_title($id)) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> | </li>';
161
- }
162
-
163
- echo '<li><a target="_blank" href="' . QLWCDC_DOCUMENTATION_URL . '">' . esc_html__('Documentation', 'woocommerce-direct-checkout') . '</a> ' . ( end($array_keys) == $id ? '' : '|' ) . ' </li>';
164
-
165
- echo '</ul><br class="clear" />';
166
- }
167
 
168
  function add_tab($settings_tabs) {
169
- $settings_tabs[QLWCDC_DOMAIN] = esc_html__('Direct Checkout', 'woocommerce-direct-checkout');
170
  return $settings_tabs;
171
  }
172
-
173
- function add_settings() {
174
- woocommerce_admin_fields($this->get_settings());
175
- }
176
-
177
- function save_settings() {
178
- woocommerce_update_options($this->get_settings());
179
- }
180
-
181
- function get_settings() {
182
-
183
- $fields = apply_filters('qlwcdc_add_fields', array());
184
-
185
- return $fields;
186
- }
187
 
188
  function register_scripts() {
189
 
190
- 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);
191
 
192
- wp_register_style(QLWCDC_DOMAIN, plugins_url('/assets/frontend/qlwcdc' . self::is_min() . '.css', QLWCDC_PLUGIN_FILE), array(), QLWCDC_PLUGIN_VERSION, 'all');
193
 
194
- 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);
195
 
196
- wp_localize_script(QLWCDC_DOMAIN, QLWCDC_DOMAIN, array(
197
- 'nonce' => wp_create_nonce(QLWCDC_DOMAIN),
198
  'delay' => 200,
199
  'timeout' => null)
200
  );
@@ -204,15 +207,15 @@ if (!class_exists('QLWCDC')) {
204
 
205
  $this->register_scripts();
206
 
207
- wp_enqueue_style(QLWCDC_DOMAIN);
208
- wp_enqueue_script(QLWCDC_DOMAIN);
209
  }
210
 
211
  function enqueue_admin_scripts() {
212
 
213
  $this->register_scripts();
214
 
215
- wp_enqueue_script(QLWCDC_DOMAIN . '-admin');
216
  }
217
 
218
  function remove_premium() {
@@ -250,7 +253,7 @@ if (!class_exists('QLWCDC')) {
250
  }
251
 
252
  function add_menu_page() {
253
- add_submenu_page('woocommerce', esc_html__('Direct Checkout', 'woocommerce-direct-checkout'), esc_html__('Direct Checkout', 'woocommerce-direct-checkout'), 'manage_woocommerce', admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(QLWCDC_DOMAIN)));
254
  }
255
 
256
  /* function woocommerce_cart_redirect_after_add($val) {
@@ -266,7 +269,9 @@ if (!class_exists('QLWCDC')) {
266
  require_once('includes/archives.php');
267
  require_once('includes/products.php');
268
  require_once('includes/checkout.php');
269
- require_once('includes/purchase.php');
 
 
270
  }
271
 
272
  function init() {
@@ -278,9 +283,9 @@ if (!class_exists('QLWCDC')) {
278
  add_action('admin_footer', array($this, 'remove_premium'));
279
  //add_action('admin_footer', array($this, 'enqueue_footer_scripts'));
280
  add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
281
- add_filter('woocommerce_sections_qlwcdc', array($this, 'add_sections'));
282
- add_action('woocommerce_sections_qlwcdc', array($this, 'add_settings'));
283
- add_action('woocommerce_settings_save_qlwcdc', array($this, 'save_settings'));
284
  //add_filter('option_woocommerce_cart_redirect_after_add', array($this, 'woocommerce_cart_redirect_after_add'));
285
  add_filter('plugin_action_links_' . plugin_basename(QLWCDC_PLUGIN_FILE), array($this, 'add_action_links'));
286
  }
2
  /**
3
  * Plugin Name: WooCommerce Direct Checkout
4
  * Description: Simplifies the checkout process to improve your sales rate.
5
+ * Version: 2.2.7
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.7');
19
  }
20
  if (!defined('QLWCDC_PLUGIN_FILE')) {
21
  define('QLWCDC_PLUGIN_FILE', __FILE__);
23
  if (!defined('QLWCDC_PLUGIN_DIR')) {
24
  define('QLWCDC_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
25
  }
26
+ if (!defined('QLWCDC_PREFIX')) {
27
+ define('QLWCDC_PREFIX', 'qlwcdc');
28
+ }
29
  if (!defined('QLWCDC_DOMAIN')) {
30
+ define('QLWCDC_DOMAIN', QLWCDC_PREFIX);
31
  }
32
  if (!defined('QLWCDC_WORDPRESS_URL')) {
33
  define('QLWCDC_WORDPRESS_URL', 'https://wordpress.org/plugins/woocommerce-direct-checkout/');
144
  function add_action_links($links) {
145
 
146
  $links[] = '<a target="_blank" href="' . QLWCDC_PURCHASE_URL . '">' . esc_html__('Premium', 'woocommerce-direct-checkout') . '</a>';
147
+ $links[] = '<a href="' . admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(QLWCDC_PREFIX)) . '">' . esc_html__('Settings', 'woocommerce-direct-checkout') . '</a>';
148
 
149
  return $links;
150
  }
151
 
152
+ // function add_sections($sections = array()) {
153
+ //
154
+ // global $current_section;
155
+ //
156
+ // $sections = apply_filters('qlwcdc_add_sections', array());
157
+ //
158
+ // echo '<ul class="subsubsub">';
159
+ //
160
+ // $array_keys = array_keys($sections);
161
+ //
162
+ // foreach ($sections as $id => $label) {
163
+ // echo '<li><a href="' . admin_url('admin.php?page=wc-settings&tab=qlwcdc&section=' . sanitize_title($id)) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> | </li>';
164
+ // }
165
+ //
166
+ // echo '<li><a target="_blank" href="' . QLWCDC_DOCUMENTATION_URL . '">' . esc_html__('Documentation', 'woocommerce-direct-checkout') . '</a> ' . ( end($array_keys) == $id ? '' : '|' ) . ' </li>';
167
+ //
168
+ // echo '</ul><br class="clear" />';
169
+ // }
170
 
171
  function add_tab($settings_tabs) {
172
+ $settings_tabs[QLWCDC_PREFIX] = esc_html__('Direct Checkout', 'woocommerce-direct-checkout');
173
  return $settings_tabs;
174
  }
175
+ //
176
+ // function add_settings() {
177
+ // woocommerce_admin_fields($this->get_settings());
178
+ // }
179
+ //
180
+ // function save_settings() {
181
+ // woocommerce_update_options($this->get_settings());
182
+ // }
183
+ //
184
+ // function get_settings() {
185
+ //
186
+ // $fields = apply_filters('qlwcdc_add_fields', array());
187
+ //
188
+ // return $fields;
189
+ // }
190
 
191
  function register_scripts() {
192
 
193
+ wp_register_script(QLWCDC_PREFIX . '-admin', plugins_url('/assets/backend/qlwcdc' . self::is_min() . '-admin.js', QLWCDC_PLUGIN_FILE), array('jquery'), QLWCDC_PLUGIN_VERSION, true);
194
 
195
+ wp_register_style(QLWCDC_PREFIX, plugins_url('/assets/frontend/qlwcdc' . self::is_min() . '.css', QLWCDC_PLUGIN_FILE), array(), QLWCDC_PLUGIN_VERSION, 'all');
196
 
197
+ wp_register_script(QLWCDC_PREFIX, plugins_url('/assets/frontend/qlwcdc' . self::is_min() . '.js', QLWCDC_PLUGIN_FILE), array('jquery', 'wc-add-to-cart-variation'), QLWCDC_PLUGIN_VERSION, true);
198
 
199
+ wp_localize_script(QLWCDC_PREFIX, QLWCDC_PREFIX, array(
200
+ 'nonce' => wp_create_nonce(QLWCDC_PREFIX),
201
  'delay' => 200,
202
  'timeout' => null)
203
  );
207
 
208
  $this->register_scripts();
209
 
210
+ wp_enqueue_style(QLWCDC_PREFIX);
211
+ wp_enqueue_script(QLWCDC_PREFIX);
212
  }
213
 
214
  function enqueue_admin_scripts() {
215
 
216
  $this->register_scripts();
217
 
218
+ wp_enqueue_script(QLWCDC_PREFIX . '-admin');
219
  }
220
 
221
  function remove_premium() {
253
  }
254
 
255
  function add_menu_page() {
256
+ add_submenu_page('woocommerce', esc_html__('Direct Checkout', 'woocommerce-direct-checkout'), esc_html__('Direct Checkout', 'woocommerce-direct-checkout'), 'manage_woocommerce', admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(QLWCDC_PREFIX)));
257
  }
258
 
259
  /* function woocommerce_cart_redirect_after_add($val) {
269
  require_once('includes/archives.php');
270
  require_once('includes/products.php');
271
  require_once('includes/checkout.php');
272
+ //require_once('includes/purchase.php');
273
+ require_once('includes/premium.php');
274
+ require_once('includes/suggestions.php');
275
  }
276
 
277
  function init() {
283
  add_action('admin_footer', array($this, 'remove_premium'));
284
  //add_action('admin_footer', array($this, 'enqueue_footer_scripts'));
285
  add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
286
+ // add_filter('woocommerce_sections_qlwcdc', array($this, 'add_sections'));
287
+ // add_action('woocommerce_sections_qlwcdc', array($this, 'add_settings'));
288
+ // add_action('woocommerce_settings_save_qlwcdc', array($this, 'save_settings'));
289
  //add_filter('option_woocommerce_cart_redirect_after_add', array($this, 'woocommerce_cart_redirect_after_add'));
290
  add_filter('plugin_action_links_' . plugin_basename(QLWCDC_PLUGIN_FILE), array($this, 'add_action_links'));
291
  }