I use the Admin Order Page of WooCommerce to book certain products in a box office.
I want to make certain customer data required fields. (Like first_name,last_name,email etc.)
That the order can only be processed (saved) with this data entered in the billing information field.
I haven't found any solution on the internet that makes the fields in the admin panel required. Only found solutions for the frontend.
Any ideas?
1 Answers
Answers 1
this will prevent "Save order" button from firing if first_name is empty in the billing section.
add_filter('woocommerce_admin_billing_fields', 'woocommerce_require_admin_billing_fields'); function woocommerce_require_admin_billing_fields( $fields ){ $fields['first_name']['custom_attributes'] = array( 'required' => 'required' ); // $fields['last_name']['custom_attributes'] = array( 'required' => 'required' ); // for last_name return $fields; }
but keep in mind that this prevention is only on client side and will not work on older browsers...
I can't find a way to stop post from saving on the server side.
0 comments:
Post a Comment