enhance #23381 Prevent the Cart, checkout and my account page from being set to the same page.

This commit is contained in:
parmarhardip 2019-04-24 15:59:14 +05:30
parent f20a48b1e4
commit f643c516d1
1 changed files with 15 additions and 0 deletions

View File

@ -89,6 +89,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'default' => '',
'class' => 'wc-enhanced-select-nostd',
'css' => 'min-width:300px;',
'args' => array( 'exclude' => array( wc_get_page_id( 'cart' ), wc_get_page_id( 'myaccount' ) ) ),
'desc_tip' => true,
),
@ -101,6 +102,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'default' => '',
'class' => 'wc-enhanced-select-nostd',
'css' => 'min-width:300px;',
'args' => array( 'exclude' => array( wc_get_page_id( 'cart' ), wc_get_page_id( 'checkout' ) ) ),
'desc_tip' => true,
),
@ -430,6 +432,19 @@ class WC_Settings_Advanced extends WC_Settings_Page {
$_POST['woocommerce_terms_page_id'] = '';
}
// Prevent the Cart, checkout and my account page from being set to the same page.
if ( isset( $_POST['woocommerce_cart_page_id'], $_POST['woocommerce_checkout_page_id'], $_POST['woocommerce_myaccount_page_id'] ) ) {
if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_checkout_page_id'] ) {
$_POST['woocommerce_checkout_page_id'] = '';
}
if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) {
$_POST['woocommerce_myaccount_page_id'] = '';
}
if ( $_POST['woocommerce_checkout_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) {
$_POST['woocommerce_myaccount_page_id'] = '';
}
}
WC_Admin_Settings::save_fields( $settings );
if ( $current_section ) {