Custom Snippet
-
Hi, I installed the plugin and it works perfectly, I also have Snippets for woocommerce, but if I try to put the age field it doesn’t work, if I deactivate the plugin it does not give an error and I don’t understand what it is due to:
add_filter( 'woocommerce_billing_fields', 'add_birth_date_billing_field', 20, 1 ); function add_birth_date_billing_field($billing_fields) { $billing_fields['billing_birth_date'] = array( 'type' => 'date', 'label' => __('Birth date'), 'class' => array('form-row-wide'), 'priority' => 25, 'required' => true, 'clear' => true, ); return $billing_fields; } add_action( 'woocommerce_checkout_update_customer', 'save_checkout_account_birthday_field', 10, 2 ); function save_checkout_account_birthday_field( $customer, $data ){ if ( isset($_POST['billing_birth_date']) && ! empty($_POST['billing_birth_date']) ) { $customer->update_meta_data( 'billing_birth_date', sanitize_text_field($_POST['billing_birth_date']) ); } }tnx
The page I need help with: [log in to see the link]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Custom Snippet’ is closed to new replies.