change save logic
This commit is contained in:
parent
ec004dbdcd
commit
21037bb406
|
@ -86,9 +86,11 @@ export const Edit = ( {
|
||||||
} );
|
} );
|
||||||
// Hack to get it update in editor
|
// Hack to get it update in editor
|
||||||
wcSettings.defaultFields.phone.hidden = ! showField;
|
wcSettings.defaultFields.phone.hidden = ! showField;
|
||||||
wcSettings.defaultFields.phone.required = showField;
|
if ( showField ) {
|
||||||
|
wcSettings.defaultFields.phone.required = true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
console.log( { requirePhoneField, showPhoneField } );
|
||||||
const setRequirePhoneFieldEntity = ( value: string ) => {
|
const setRequirePhoneFieldEntity = ( value: string ) => {
|
||||||
dispatch( coreStore ).editEntityRecord( 'root', 'site', undefined, {
|
dispatch( coreStore ).editEntityRecord( 'root', 'site', undefined, {
|
||||||
woocommerce_checkout_phone_field:
|
woocommerce_checkout_phone_field:
|
||||||
|
@ -245,10 +247,8 @@ export const Edit = ( {
|
||||||
value={ {
|
value={ {
|
||||||
showApartmentField,
|
showApartmentField,
|
||||||
showCompanyField,
|
showCompanyField,
|
||||||
showPhoneField,
|
|
||||||
requireApartmentField,
|
requireApartmentField,
|
||||||
requireCompanyField,
|
requireCompanyField,
|
||||||
requirePhoneField,
|
|
||||||
showOrderNotes,
|
showOrderNotes,
|
||||||
showPolicyLinks,
|
showPolicyLinks,
|
||||||
showReturnToCart,
|
showReturnToCart,
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Checkout extends AbstractBlock {
|
||||||
protected function initialize() {
|
protected function initialize() {
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
add_action( 'wp_loaded', array( $this, 'register_patterns' ) );
|
add_action( 'wp_loaded', array( $this, 'register_patterns' ) );
|
||||||
add_action( 'init', array( $this, 'register_settings' ) );
|
add_action( 'wp_loaded', array( $this, 'register_settings' ) );
|
||||||
// This prevents the page redirecting when the cart is empty. This is so the editor still loads the page preview.
|
// This prevents the page redirecting when the cart is empty. This is so the editor still loads the page preview.
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_checkout_redirect_empty_cart',
|
'woocommerce_checkout_redirect_empty_cart',
|
||||||
|
|
Loading…
Reference in New Issue