You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to add custom checkbox field into Admin Edit User Profil Page using the filter hook "woocommerce_customer_meta_fields". The field is displayed to the right position and I can update the value 馃憤.
(I'm using Woocommerce version 3.3.4)
The problem is that after the value's update (0 by default) the custom field disappeared.
The checkbox's field is expecting 0 or 1 as value.
When the value is equal to 0 the field is visible, but when I change the value to 1 it is not.
This is the snippet I've added in my functions.php :
add_filter( 'woocommerce_customer_meta_fields', 'filter_woocommerce_customer_meta_fields', 10, 1 );
function filter_woocommerce_customer_meta_fields( $array ) {
$array += array(
'enable_sms_alert' => array(
'title' => 'Activation de l\'alerte SMS',
'fields' => array(
'enable_sms_alert' => array(
'label' => 'Cochez la case pour activer l\'alerte SMS',
'description' => 'Si l\'option est activ茅e, vous recevrez des alertes SMS (au num茅ro renseigner) pour les v茅hicules pr茅sents dans votre Wishlist',
'type' => 'checkbox',
'class' => 'enable_sms_alert'
)
)
)
);
return $array;
}
I've tried to change the type field to text (number isnt output) and I've noticed that when the value is a string like "Hello World" the field is still visible, but if I change the value to 1 or another number than 0 the field is not displayed anymore.
Any ideas ?
Thanks for your time 馃槂
Regards
EDITED PART:
I've notice that the hooks arent triggered when I've a custom value different of 0 or "letter string".
The text was updated successfully, but these errors were encountered:
I'm not exactly sure what you're saying, but your code snippet works fine for me:
I would look through WC_Admin_Settings to see how it handles checkbox inputs and compare that to the input you're giving it to make sure it's all correct.
Closing this issue as it's a development support request and not a bug in the core plugin. For future development questions I recommend joining the WooCommerce community Slack using the form at the bottom of this page.
Hi there,
I've tried to add custom checkbox field into Admin Edit User Profil Page using the filter hook "woocommerce_customer_meta_fields". The field is displayed to the right position and I can update the value 馃憤.
(I'm using Woocommerce version 3.3.4)
The problem is that after the value's update (0 by default) the custom field disappeared.
The checkbox's field is expecting 0 or 1 as value.
When the value is equal to 0 the field is visible, but when I change the value to 1 it is not.
This is the snippet I've added in my functions.php :
I've tried to change the type field to text (number isnt output) and I've noticed that when the value is a string like "Hello World" the field is still visible, but if I change the value to 1 or another number than 0 the field is not displayed anymore.
Any ideas ?
Thanks for your time 馃槂
Regards
EDITED PART:
I've notice that the hooks arent triggered when I've a custom value different of 0 or "letter string".
The text was updated successfully, but these errors were encountered: