WPPizza – A Restaurant Plugin for WordPress › Support › Code Snippets WPPizza v2.x (read only)
(Code Snippets for v3.x) › adding customer checkout fields
Viewing 1 post (of 1 total)
- AuthorPosts
- 18 June, 2014 at 11:44 am #4104
if you need more than the 12 fields available under wppizza->order form settings try the following filters in your functions.php (As of 2.9.4.6+)
/****************************************************************** 'sort' => sets sort order 'key' => should be unique (otherwise there isn't really any point) 'lbl' => label of the field 'type' => text, textarea, email or select 'enabled' => should really always be true (otherwise there isn't really any point doing this) 'required' => makes field required to be filled in 'required_on_pickup' => makes field required to be filled in even when self pickup eabled 'prefill' => prefills field (if available) 'onregister'=> adds field to registration page 'add_to_subject_line'=> will add output to subject lines of email 'value'=> array() if type =email,text or textarea, array('val1','val2',....) if type=select 'placeholder'=> set a placeholder for formfield *****************************************************************/ add_filter( 'wppizza_filter_formfields_register', 'my_order_fields');//registration page. onregister must also be true add_filter( 'wppizza_filter_formfields_profile', 'my_order_fields');//profile page. add_filter( 'wppizza_filter_formfields_order', 'my_order_fields');//order form. function my_order_fields($formfields) { /**text field (set type=email if email field, type=textarea if textarea)**/ $formfields[]=array('sort' => 0,'key' => 'billingname','lbl' => 'Billing Name :','type' => 'text','enabled' => 1,'required' => false,'required_on_pickup' =>false, 'prefill' => 1, 'onregister' => 1, 'add_to_subject_line'=>false, 'value' => array(),'placeholder'=>false); /**select field**/ $formfields[]=array('sort' => 0,'key' => 'billingcountry','lbl' => 'Billing Country:','type' => 'select','enabled' => 1,'required' => false,'required_on_pickup' =>false, 'prefill' => 1, 'onregister' => 1, 'add_to_subject_line'=>false, 'value' => array('United Kingdom','United States'), 'placeholder'=>false); return $formfields; }
- AuthorPosts
Viewing 1 post (of 1 total)
- The topic ‘adding customer checkout fields’ is closed to new replies.