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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / settings / class-wc-settings-advanced.php
woocommerce / includes / admin / settings Last commit date
views 1 month ago class-wc-settings-accounts.php 5 months ago class-wc-settings-advanced.php 1 month ago class-wc-settings-checkout.php 5 years ago class-wc-settings-emails.php 1 month ago class-wc-settings-general.php 1 month ago class-wc-settings-integrations.php 1 year ago class-wc-settings-page.php 1 week ago class-wc-settings-payment-gateways.php 1 week ago class-wc-settings-point-of-sale.php 3 months ago class-wc-settings-products.php 1 month ago class-wc-settings-shipping.php 3 months ago class-wc-settings-site-visibility.php 2 years ago class-wc-settings-tax.php 5 months ago
class-wc-settings-advanced.php
613 lines
1 <?php
2 /**
3 * WooCommerce advanced settings
4 *
5 * @package WooCommerce\Admin
6 */
7
8 use Automattic\WooCommerce\Internal\Features\FeaturesController;
9 use Automattic\WooCommerce\Utilities\FeaturesUtil;
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Settings for API.
15 */
16 if ( class_exists( 'WC_Settings_Advanced', false ) ) {
17 return new WC_Settings_Advanced();
18 }
19
20 /**
21 * WC_Settings_Advanced.
22 */
23 class WC_Settings_Advanced extends WC_Settings_Page {
24
25 /**
26 * Constructor.
27 */
28 public function __construct() {
29 $this->id = 'advanced';
30 $this->label = __( 'Advanced', 'woocommerce' );
31
32 parent::__construct();
33 $this->notices();
34 }
35
36 /**
37 * Setting page icon.
38 *
39 * @var string
40 */
41 public $icon = 'more';
42
43 /**
44 * Get own sections.
45 *
46 * @return array
47 */
48 protected function get_own_sections() {
49 $sections = array(
50 '' => __( 'Page setup', 'woocommerce' ),
51 'keys' => __( 'REST API keys', 'woocommerce' ),
52 );
53
54 $features_controller = wc_get_container()->get( FeaturesController::class );
55 if ( $features_controller->feature_is_enabled( 'rest_api_caching' ) ) {
56 $sections['rest_api_caching'] = __( 'REST API caching', 'woocommerce' );
57 }
58
59 $sections['webhooks'] = __( 'Webhooks', 'woocommerce' );
60
61 if ( has_filter( 'woocommerce_settings_rest_api' ) ) {
62 $sections['legacy_api'] = __( 'Legacy API', 'woocommerce' );
63 }
64
65 $sections['woocommerce_com'] = __( 'WooCommerce.com', 'woocommerce' );
66
67 if ( FeaturesUtil::feature_is_enabled( 'blueprint' ) ) {
68 $sections['blueprint'] = __( 'Blueprint (beta)', 'woocommerce' );
69 }
70
71 return $sections;
72 }
73
74 /**
75 * Get settings for the default section.
76 *
77 * @return array
78 */
79 protected function get_settings_for_default_section() {
80 $settings =
81 array(
82 array(
83 'title' => __( 'Page setup', 'woocommerce' ),
84 'desc' => __( 'These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce' ),
85 'type' => 'title',
86 'id' => 'advanced_page_options',
87 ),
88
89 array(
90 'title' => __( 'Cart page', 'woocommerce' ),
91 /* Translators: %s Page contents. */
92 'desc' => __( 'Page where shoppers review their shopping cart', 'woocommerce' ),
93 'id' => 'woocommerce_cart_page_id',
94 'type' => 'single_select_page_with_search',
95 'default' => '',
96 'class' => 'wc-page-search',
97 'css' => 'min-width:300px;',
98 'args' => array(
99 'exclude' =>
100 array(
101 wc_get_page_id( 'checkout' ),
102 wc_get_page_id( 'myaccount' ),
103 ),
104 ),
105 'desc_tip' => true,
106 'autoload' => false,
107 ),
108
109 array(
110 'title' => __( 'Checkout page', 'woocommerce' ),
111 /* Translators: %s Page contents. */
112 'desc' => __( 'Page where shoppers go to finalize their purchase', 'woocommerce' ),
113 'id' => 'woocommerce_checkout_page_id',
114 'type' => 'single_select_page_with_search',
115 'default' => wc_get_page_id( 'checkout' ),
116 'class' => 'wc-page-search',
117 'css' => 'min-width:300px;',
118 'args' => array(
119 'exclude' =>
120 array(
121 wc_get_page_id( 'cart' ),
122 wc_get_page_id( 'myaccount' ),
123 ),
124 ),
125 'desc_tip' => true,
126 'autoload' => false,
127 ),
128
129 array(
130 'title' => __( 'My account page', 'woocommerce' ),
131 /* Translators: %s Page contents. */
132 'desc' => sprintf( __( 'Page contents: [%s]', 'woocommerce' ), apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) ),
133 'id' => 'woocommerce_myaccount_page_id',
134 'type' => 'single_select_page_with_search',
135 'default' => '',
136 'class' => 'wc-page-search',
137 'css' => 'min-width:300px;',
138 'args' => array(
139 'exclude' =>
140 array(
141 wc_get_page_id( 'cart' ),
142 wc_get_page_id( 'checkout' ),
143 ),
144 ),
145 'desc_tip' => true,
146 'autoload' => false,
147 ),
148
149 array(
150 'title' => __( 'Terms and conditions', 'woocommerce' ),
151 'desc' => __( 'If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce' ),
152 'id' => 'woocommerce_terms_page_id',
153 'default' => '',
154 'class' => 'wc-page-search',
155 'css' => 'min-width:300px;',
156 'type' => 'single_select_page_with_search',
157 'args' => array( 'exclude' => wc_get_page_id( 'checkout' ) ),
158 'desc_tip' => true,
159 'autoload' => false,
160 ),
161
162 array(
163 'type' => 'sectionend',
164 'id' => 'advanced_page_options',
165 ),
166
167 array(
168 'title' => '',
169 'type' => 'title',
170 'id' => 'checkout_process_options',
171 ),
172
173 'force_ssl_checkout' => array(
174 'title' => __( 'Secure checkout', 'woocommerce' ),
175 'desc' => __( 'Force secure checkout', 'woocommerce' ),
176 'id' => 'woocommerce_force_ssl_checkout',
177 'default' => 'no',
178 'type' => 'checkbox',
179 'checkboxgroup' => 'start',
180 'show_if_checked' => 'option',
181 /* Translators: %s Docs URL. */
182 'desc_tip' => sprintf( __( 'Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce' ), 'https://woocommerce.com/document/ssl-and-https/#section-3' ),
183 ),
184
185 'unforce_ssl_checkout' => array(
186 'desc' => __( 'Force HTTP when leaving the checkout', 'woocommerce' ),
187 'id' => 'woocommerce_unforce_ssl_checkout',
188 'default' => 'no',
189 'type' => 'checkbox',
190 'checkboxgroup' => 'end',
191 'show_if_checked' => 'yes',
192 ),
193
194 array(
195 'type' => 'sectionend',
196 'id' => 'checkout_process_options',
197 ),
198
199 array(
200 'title' => __( 'Checkout endpoints', 'woocommerce' ),
201 'type' => 'title',
202 'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions during the checkout process. They should be unique.', 'woocommerce' ),
203 'id' => 'checkout_endpoint_options',
204 ),
205
206 array(
207 'title' => __( 'Pay', 'woocommerce' ),
208 'desc' => __( 'Endpoint for the "Checkout &rarr; Pay" page.', 'woocommerce' ),
209 'id' => 'woocommerce_checkout_pay_endpoint',
210 'type' => 'text',
211 'default' => 'order-pay',
212 'desc_tip' => true,
213 ),
214
215 array(
216 'title' => __( 'Order received', 'woocommerce' ),
217 'desc' => __( 'Endpoint for the "Checkout &rarr; Order received" page.', 'woocommerce' ),
218 'id' => 'woocommerce_checkout_order_received_endpoint',
219 'type' => 'text',
220 'default' => 'order-received',
221 'desc_tip' => true,
222 ),
223
224 array(
225 'title' => __( 'Add payment method', 'woocommerce' ),
226 'desc' => __( 'Endpoint for the "Checkout &rarr; Add payment method" page.', 'woocommerce' ),
227 'id' => 'woocommerce_myaccount_add_payment_method_endpoint',
228 'type' => 'text',
229 'default' => 'add-payment-method',
230 'desc_tip' => true,
231 ),
232
233 array(
234 'title' => __( 'Delete payment method', 'woocommerce' ),
235 'desc' => __( 'Endpoint for the delete payment method page.', 'woocommerce' ),
236 'id' => 'woocommerce_myaccount_delete_payment_method_endpoint',
237 'type' => 'text',
238 'default' => 'delete-payment-method',
239 'desc_tip' => true,
240 ),
241
242 array(
243 'title' => __( 'Set default payment method', 'woocommerce' ),
244 'desc' => __( 'Endpoint for the setting a default payment method page.', 'woocommerce' ),
245 'id' => 'woocommerce_myaccount_set_default_payment_method_endpoint',
246 'type' => 'text',
247 'default' => 'set-default-payment-method',
248 'desc_tip' => true,
249 ),
250
251 array(
252 'type' => 'sectionend',
253 'id' => 'checkout_endpoint_options',
254 ),
255
256 array(
257 'title' => __( 'Account endpoints', 'woocommerce' ),
258 'type' => 'title',
259 'desc' => __( 'Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint.', 'woocommerce' ),
260 'id' => 'account_endpoint_options',
261 ),
262
263 array(
264 'title' => __( 'Orders', 'woocommerce' ),
265 'desc' => __( 'Endpoint for the "My account &rarr; Orders" page.', 'woocommerce' ),
266 'id' => 'woocommerce_myaccount_orders_endpoint',
267 'type' => 'text',
268 'default' => 'orders',
269 'desc_tip' => true,
270 ),
271
272 array(
273 'title' => __( 'View order', 'woocommerce' ),
274 'desc' => __( 'Endpoint for the "My account &rarr; View order" page.', 'woocommerce' ),
275 'id' => 'woocommerce_myaccount_view_order_endpoint',
276 'type' => 'text',
277 'default' => 'view-order',
278 'desc_tip' => true,
279 ),
280
281 array(
282 'title' => __( 'Downloads', 'woocommerce' ),
283 'desc' => __( 'Endpoint for the "My account &rarr; Downloads" page.', 'woocommerce' ),
284 'id' => 'woocommerce_myaccount_downloads_endpoint',
285 'type' => 'text',
286 'default' => 'downloads',
287 'desc_tip' => true,
288 ),
289
290 array(
291 'title' => __( 'Edit account', 'woocommerce' ),
292 'desc' => __( 'Endpoint for the "My account &rarr; Edit account" page.', 'woocommerce' ),
293 'id' => 'woocommerce_myaccount_edit_account_endpoint',
294 'type' => 'text',
295 'default' => 'edit-account',
296 'desc_tip' => true,
297 ),
298
299 array(
300 'title' => __( 'Addresses', 'woocommerce' ),
301 'desc' => __( 'Endpoint for the "My account &rarr; Addresses" page.', 'woocommerce' ),
302 'id' => 'woocommerce_myaccount_edit_address_endpoint',
303 'type' => 'text',
304 'default' => 'edit-address',
305 'desc_tip' => true,
306 ),
307
308 array(
309 'title' => __( 'Payment methods', 'woocommerce' ),
310 'desc' => __( 'Endpoint for the "My account &rarr; Payment methods" page.', 'woocommerce' ),
311 'id' => 'woocommerce_myaccount_payment_methods_endpoint',
312 'type' => 'text',
313 'default' => 'payment-methods',
314 'desc_tip' => true,
315 ),
316
317 array(
318 'title' => __( 'Lost password', 'woocommerce' ),
319 'desc' => __( 'Endpoint for the "My account &rarr; Lost password" page.', 'woocommerce' ),
320 'id' => 'woocommerce_myaccount_lost_password_endpoint',
321 'type' => 'text',
322 'default' => 'lost-password',
323 'desc_tip' => true,
324 ),
325
326 array(
327 'title' => __( 'Logout', 'woocommerce' ),
328 'desc' => __( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true', 'woocommerce' ),
329 'id' => 'woocommerce_logout_endpoint',
330 'type' => 'text',
331 'default' => 'customer-logout',
332 'desc_tip' => true,
333 ),
334
335 array(
336 'type' => 'sectionend',
337 'id' => 'account_endpoint_options',
338 ),
339 );
340
341 $settings = apply_filters( 'woocommerce_settings_pages', $settings );
342
343 if ( wc_site_is_https() ) {
344 unset( $settings['unforce_ssl_checkout'], $settings['force_ssl_checkout'] );
345 }
346
347 return $settings;
348 }
349
350 /**
351 * Get settings for the WooCommerce.com section.
352 *
353 * @return array
354 */
355 protected function get_settings_for_woocommerce_com_section() {
356 $tracking_info_text = sprintf( '<a href="%s" target="_blank">%s</a>', 'https://woocommerce.com/usage-tracking', esc_html__( 'WooCommerce.com Usage Tracking Documentation', 'woocommerce' ) );
357
358 $settings =
359 array(
360 array(
361 'title' => esc_html__( 'Usage Tracking', 'woocommerce' ),
362 'type' => 'title',
363 'id' => 'tracking_options',
364 'desc' => __( 'Gathering usage data allows us to tailor your store setup experience, offer more relevant content, and help make WooCommerce better for everyone.', 'woocommerce' ),
365 ),
366 array(
367 'title' => __( 'Enable tracking', 'woocommerce' ),
368 'desc' => __( 'Allow usage of WooCommerce to be tracked', 'woocommerce' ),
369 /* Translators: %s URL to tracking info screen. */
370 'desc_tip' => sprintf( esc_html__( 'To opt out, leave this box unticked. Your store remains untracked, and no data will be collected. Read about what usage data is tracked at: %s.', 'woocommerce' ), $tracking_info_text ),
371 'id' => 'woocommerce_allow_tracking',
372 'type' => 'checkbox',
373 'checkboxgroup' => 'start',
374 'default' => 'no',
375 'autoload' => true,
376 ),
377 array(
378 'type' => 'sectionend',
379 'id' => 'tracking_options',
380 ),
381 array(
382 'title' => esc_html__( 'Marketplace suggestions', 'woocommerce' ),
383 'type' => 'title',
384 'id' => 'marketplace_suggestions',
385 'desc' => __( 'We show contextual suggestions for official extensions that may be helpful to your store.', 'woocommerce' ),
386 ),
387 array(
388 'title' => __( 'Show Suggestions', 'woocommerce' ),
389 'desc' => __( 'Display suggestions within WooCommerce', 'woocommerce' ),
390 'desc_tip' => esc_html__( 'Leave this box unchecked if you do not want to pull suggested extensions from WooCommerce.com.', 'woocommerce' ),
391 'id' => 'woocommerce_show_marketplace_suggestions',
392 'type' => 'checkbox',
393 'checkboxgroup' => 'start',
394 'default' => 'yes',
395 'autoload' => false,
396 ),
397 array(
398 'type' => 'sectionend',
399 'id' => 'marketplace_suggestions',
400 ),
401 );
402
403 return apply_filters( 'woocommerce_com_integration_settings', $settings );
404 }
405
406 /**
407 * Get settings for the legacy API section.
408 *
409 * The section is only registered when an extension has hooked into the
410 * `woocommerce_settings_rest_api` filter, so this acts purely as an
411 * extension point — core no longer ships any settings of its own here.
412 *
413 * @return array
414 */
415 protected function get_settings_for_legacy_api_section() {
416 /**
417 * Filter the settings rendered in the Legacy API section of the Advanced settings tab.
418 *
419 * Core no longer ships any settings in this section; the section itself is only
420 * registered when at least one callback is hooked into this filter.
421 *
422 * @since 3.4.0
423 * @param array $settings Settings array. Empty by default.
424 */
425 return apply_filters( 'woocommerce_settings_rest_api', array() );
426 }
427
428 /**
429 * Get settings for the REST API caching section.
430 *
431 * @return array
432 */
433 protected function get_settings_for_rest_api_caching_section() {
434 $has_object_cache = wp_using_ext_object_cache();
435
436 $settings = array(
437 array(
438 'title' => __( 'REST API response cache', 'woocommerce' ),
439 'type' => 'title',
440 'desc' => __( 'These settings control backend caching and cache control headers for REST API responses.', 'woocommerce' ),
441 'id' => 'rest_api_cache_options',
442 ),
443 );
444
445 if ( ! $has_object_cache ) {
446 $settings[] = array(
447 'type' => 'notice',
448 'id' => 'rest_api_cache_warning',
449 'notice_type' => 'warning',
450 'text' => sprintf(
451 /* translators: %1$s and %2$s are opening and closing <a> tags */
452 __( 'Backend caching requires a WordPress object cache plugin (Redis, Memcached, etc.) to be installed and active. %1$sLearn more about object caching%2$s.', 'woocommerce' ),
453 '<a href="https://developer.wordpress.org/reference/classes/wp_object_cache/" target="_blank">',
454 '</a>'
455 ),
456 );
457 }
458
459 $backend_caching_setting = array(
460 'title' => __( 'Enable backend caching', 'woocommerce' ),
461 'desc' => __( 'Cache REST API responses on the server', 'woocommerce' ),
462 'id' => 'woocommerce_rest_api_enable_backend_caching',
463 'type' => 'checkbox',
464 'default' => 'no',
465 'disabled' => ! $has_object_cache,
466 'fixed_value' => $has_object_cache ? null : 'no',
467 'desc_tip' => __( 'Enables responses for REST API endpoints configured as cacheable. Requires an external object cache.<br/>This setting should be enabled only if no other plugins that handle caching are active.', 'woocommerce' ),
468 );
469
470 $settings[] = $backend_caching_setting;
471
472 $settings[] = array(
473 'title' => __( 'Enable cache control headers', 'woocommerce' ),
474 'desc' => __( 'Send cache control headers and support 304 Not Modified responses', 'woocommerce' ),
475 'id' => 'woocommerce_rest_api_enable_cache_headers',
476 'type' => 'checkbox',
477 'default' => 'yes',
478 'desc_tip' => __( 'Enables including ETag and Cache-Control headers, and returning 304 Not Modified responses, for REST API endpoints configured as cacheable.', 'woocommerce' ),
479 );
480
481 $settings[] = array(
482 'type' => 'sectionend',
483 'id' => 'rest_api_cache_options',
484 );
485
486 /**
487 * Filter REST API cache settings.
488 *
489 * @since 10.5.0
490 * @param array $settings REST API cache settings.
491 */
492 return apply_filters( 'woocommerce_rest_api_cache_settings', $settings );
493 }
494
495 /**
496 * Get settings for the Blueprint section.
497 *
498 * @return array
499 */
500 protected function get_settings_for_blueprint_section() {
501 $settings =
502 array(
503 array(
504 'id' => 'wc_settings_blueprint_slotfill',
505 'type' => 'slotfill_placeholder',
506 ),
507 );
508
509 return $settings;
510 }
511
512 /**
513 * Form method.
514 *
515 * @deprecated 3.4.4
516 *
517 * @param string $method Method name.
518 *
519 * @return string
520 */
521 public function form_method( $method ) {
522 return 'post';
523 }
524
525 /**
526 * Notices.
527 */
528 private function notices() {
529 // phpcs:disable WordPress.Security.NonceVerification.Recommended
530 if ( isset( $_GET['section'] ) && 'webhooks' === $_GET['section'] ) {
531 WC_Admin_Webhooks::notices();
532 }
533 if ( isset( $_GET['section'] ) && 'keys' === $_GET['section'] ) {
534 WC_Admin_API_Keys::notices();
535 }
536 // phpcs:enable
537 }
538
539 /**
540 * Output the settings.
541 */
542 public function output() {
543 global $current_section, $hide_save_button;
544
545 if ( 'blueprint' === $current_section ) {
546 $hide_save_button = true;
547 }
548
549 if ( 'webhooks' === $current_section ) {
550 WC_Admin_Webhooks::page_output();
551 } elseif ( 'keys' === $current_section ) {
552 WC_Admin_API_Keys::page_output();
553 } else {
554 parent::output();
555 }
556 }
557
558 /**
559 * Save settings.
560 */
561 public function save() {
562 // phpcs:disable WordPress.Security.NonceVerification.Missing
563 global $current_section;
564
565 $prev_value = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ) ? 'yes' : 'no';
566 $new_value = isset( $_POST['woocommerce_allow_tracking'] ) && ( 'yes' === $_POST['woocommerce_allow_tracking'] || '1' === $_POST['woocommerce_allow_tracking'] ) ? 'yes' : 'no';
567
568 if ( apply_filters( 'woocommerce_rest_api_valid_to_save', ! in_array( $current_section, array( 'keys', 'webhooks' ), true ) ) ) {
569 // Prevent the T&Cs and checkout page from being set to the same page.
570 if ( isset( $_POST['woocommerce_terms_page_id'], $_POST['woocommerce_checkout_page_id'] ) && $_POST['woocommerce_terms_page_id'] === $_POST['woocommerce_checkout_page_id'] ) {
571 $_POST['woocommerce_terms_page_id'] = '';
572 }
573
574 // Prevent the Cart, checkout and my account page from being set to the same page.
575 if ( isset( $_POST['woocommerce_cart_page_id'], $_POST['woocommerce_checkout_page_id'], $_POST['woocommerce_myaccount_page_id'] ) ) {
576 if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_checkout_page_id'] ) {
577 $_POST['woocommerce_checkout_page_id'] = '';
578 }
579 if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) {
580 $_POST['woocommerce_myaccount_page_id'] = '';
581 }
582 if ( $_POST['woocommerce_checkout_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) {
583 $_POST['woocommerce_myaccount_page_id'] = '';
584 }
585 }
586
587 if ( class_exists( 'WC_Tracks' ) && 'no' === $new_value && 'yes' === $prev_value ) {
588 WC_Tracks::track_woocommerce_allow_tracking_toggled( $prev_value, $new_value, 'settings' );
589 }
590
591 $this->save_settings_for_current_section();
592 $this->do_update_options_action();
593
594 if ( class_exists( 'WC_Tracks' ) && 'yes' === $new_value && 'no' === $prev_value ) {
595 WC_Tracks::track_woocommerce_allow_tracking_toggled( $prev_value, $new_value, 'settings' );
596 }
597 }
598 // phpcs:enable
599 }
600 }
601
602 // phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound, Generic.Commenting.Todo.CommentFound
603 /**
604 * WC_Settings_Rest_API class.
605 *
606 * @deprecated 3.4 in favour of WC_Settings_Advanced.
607 */
608 class WC_Settings_Rest_API extends WC_Settings_Advanced {
609 }
610
611 return new WC_Settings_Advanced();
612 // phpcs:enable
613