Merge pull request #23479 from parmarhardip/23381
enhance #23381 Prevent the Cart, checkout and my account page from be…
This commit is contained in:
commit
eee56a254f
|
@ -51,6 +51,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
* Get settings array.
|
* Get settings array.
|
||||||
*
|
*
|
||||||
* @param string $current_section Current section slug.
|
* @param string $current_section Current section slug.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_settings( $current_section = '' ) {
|
public function get_settings( $current_section = '' ) {
|
||||||
|
@ -77,7 +78,15 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'class' => 'wc-enhanced-select-nostd',
|
'class' => 'wc-enhanced-select-nostd',
|
||||||
'css' => 'min-width:300px;',
|
'css' => 'min-width:300px;',
|
||||||
|
'args' => array(
|
||||||
|
'exclude' =>
|
||||||
|
array(
|
||||||
|
wc_get_page_id( 'checkout' ),
|
||||||
|
wc_get_page_id( 'myaccount' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
|
'autoload' => false,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
|
@ -89,7 +98,15 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'class' => 'wc-enhanced-select-nostd',
|
'class' => 'wc-enhanced-select-nostd',
|
||||||
'css' => 'min-width:300px;',
|
'css' => 'min-width:300px;',
|
||||||
|
'args' => array(
|
||||||
|
'exclude' =>
|
||||||
|
array(
|
||||||
|
wc_get_page_id( 'cart' ),
|
||||||
|
wc_get_page_id( 'myaccount' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
|
'autoload' => false,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
|
@ -101,7 +118,15 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'class' => 'wc-enhanced-select-nostd',
|
'class' => 'wc-enhanced-select-nostd',
|
||||||
'css' => 'min-width:300px;',
|
'css' => 'min-width:300px;',
|
||||||
|
'args' => array(
|
||||||
|
'exclude' =>
|
||||||
|
array(
|
||||||
|
wc_get_page_id( 'cart' ),
|
||||||
|
wc_get_page_id( 'checkout' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
|
'autoload' => false,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
|
@ -128,7 +153,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
'id' => 'checkout_process_options',
|
'id' => 'checkout_process_options',
|
||||||
),
|
),
|
||||||
|
|
||||||
'force_ssl_checkout' => array(
|
'force_ssl_checkout' => array(
|
||||||
'title' => __( 'Secure checkout', 'woocommerce' ),
|
'title' => __( 'Secure checkout', 'woocommerce' ),
|
||||||
'desc' => __( 'Force secure checkout', 'woocommerce' ),
|
'desc' => __( 'Force secure checkout', 'woocommerce' ),
|
||||||
'id' => 'woocommerce_force_ssl_checkout',
|
'id' => 'woocommerce_force_ssl_checkout',
|
||||||
|
@ -381,7 +406,9 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
* Form method.
|
* Form method.
|
||||||
*
|
*
|
||||||
* @deprecated 3.4.4
|
* @deprecated 3.4.4
|
||||||
|
*
|
||||||
* @param string $method Method name.
|
* @param string $method Method name.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function form_method( $method ) {
|
public function form_method( $method ) {
|
||||||
|
@ -430,6 +457,19 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
$_POST['woocommerce_terms_page_id'] = '';
|
$_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'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||||
|
if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { // WPCS: input var ok, CSRF ok.
|
||||||
|
$_POST['woocommerce_checkout_page_id'] = '';
|
||||||
|
}
|
||||||
|
if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) { // WPCS: input var ok, CSRF ok.
|
||||||
|
$_POST['woocommerce_myaccount_page_id'] = '';
|
||||||
|
}
|
||||||
|
if ( $_POST['woocommerce_checkout_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) { // WPCS: input var ok, CSRF ok.
|
||||||
|
$_POST['woocommerce_myaccount_page_id'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WC_Admin_Settings::save_fields( $settings );
|
WC_Admin_Settings::save_fields( $settings );
|
||||||
|
|
||||||
if ( $current_section ) {
|
if ( $current_section ) {
|
||||||
|
@ -445,6 +485,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
|
||||||
* @deprecated 3.4 in favour of WC_Settings_Advanced.
|
* @deprecated 3.4 in favour of WC_Settings_Advanced.
|
||||||
* @todo remove in 4.0.
|
* @todo remove in 4.0.
|
||||||
*/
|
*/
|
||||||
class WC_Settings_Rest_API extends WC_Settings_Advanced {} // @codingStandardsIgnoreLine.
|
class WC_Settings_Rest_API extends WC_Settings_Advanced {
|
||||||
|
} // @codingStandardsIgnoreLine.
|
||||||
|
|
||||||
return new WC_Settings_Advanced();
|
return new WC_Settings_Advanced();
|
||||||
|
|
Loading…
Reference in New Issue