WooCommerce allows you to quickly start an e-commerce store.
At some point you may need to customize some of the checkout fields to fit your project requirements.
WooCommerce like other well written plugins uses hooks extensively. Those are actions and filters which allow you or your developer to customize the WooCommerce functionality without hacking the code. Another benefit of using hooks is that those customizations will survive any WooCommerce updates.
Here's a link to the file (next do Save as) : orbisius_quick_fix_wc_ext_opt_co_fields.php
Here are all of the Shipping & Billing fields from all the filters.
[code]
array (
'first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'state' =>
array (
'type' => 'state',
'label' => 'State / County',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
),
'postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
)
array (
'first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'state' =>
array (
'type' => 'state',
'label' => 'State / County',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
),
'postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
)
array (
'billing_first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'billing_last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'billing_company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'billing_country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'billing_address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'billing_address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'billing_city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'billing_state' =>
array (
'type' => 'state',
'label' => 'Province',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
'country_field' => 'billing_country',
),
'billing_postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
'billing_phone' =>
array (
'label' => 'Phone',
'required' => true,
'type' => 'tel',
'class' =>
array (
0 => 'form-row-first',
),
'validate' =>
array (
0 => 'phone',
),
'autocomplete' => 'tel',
'priority' => 100,
),
'billing_email' =>
array (
'label' => 'Email address',
'required' => true,
'type' => 'email',
'class' =>
array (
0 => 'form-row-last',
),
'validate' =>
array (
0 => 'email',
),
'autocomplete' => 'email username',
'priority' => 110,
),
)
array (
'first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'state' =>
array (
'type' => 'state',
'label' => 'State / County',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
),
'postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
)
array (
'billing' =>
array (
'billing_first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'billing_last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'billing_company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'billing_country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'billing_address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'billing_address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'billing_city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'billing_state' =>
array (
'type' => 'state',
'label' => 'Province',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
'country_field' => 'billing_country',
),
'billing_postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
'billing_phone' =>
array (
'label' => 'Phone',
'required' => true,
'type' => 'tel',
'class' =>
array (
0 => 'form-row-first',
),
'validate' =>
array (
0 => 'phone',
),
'autocomplete' => 'tel',
'priority' => 100,
),
'billing_email' =>
array (
'label' => 'Email address',
'required' => true,
'type' => 'email',
'class' =>
array (
0 => 'form-row-last',
),
'validate' =>
array (
0 => 'email',
),
'autocomplete' => 'email username',
'priority' => 110,
),
),
'shipping' =>
array (
'shipping_first_name' =>
array (
'label' => 'First name',
'required' => false,
'class' =>
array (
0 => 'form-row-first',
),
'autocomplete' => 'given-name',
'autofocus' => true,
'priority' => 10,
),
'shipping_last_name' =>
array (
'label' => 'Last name',
'required' => false,
'class' =>
array (
0 => 'form-row-last',
),
'autocomplete' => 'family-name',
'priority' => 20,
),
'shipping_company' =>
array (
'label' => 'Company name',
'class' =>
array (
0 => 'form-row-wide',
),
'autocomplete' => 'organization',
'priority' => 30,
),
'shipping_country' =>
array (
'type' => 'country',
'label' => 'Country',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
2 => 'update_totals_on_change',
),
'autocomplete' => 'country',
'priority' => 40,
),
'shipping_address_1' =>
array (
'label' => 'Street address',
'placeholder' => 'House number and street name',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-line1',
'priority' => 50,
),
'shipping_address_2' =>
array (
'placeholder' => 'Apartment, suite, unit etc. (optional)',
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'required' => false,
'autocomplete' => 'address-line2',
'priority' => 60,
),
'shipping_city' =>
array (
'label' => 'Town / City',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'autocomplete' => 'address-level2',
'priority' => 70,
),
'shipping_state' =>
array (
'type' => 'state',
'label' => 'Province',
'required' => false,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'state',
),
'autocomplete' => 'address-level1',
'priority' => 80,
'country_field' => 'shipping_country',
),
'shipping_postcode' =>
array (
'label' => 'Postcode / ZIP',
'required' => true,
'class' =>
array (
0 => 'form-row-wide',
1 => 'address-field',
),
'validate' =>
array (
0 => 'postcode',
),
'autocomplete' => 'postal-code',
'priority' => 90,
),
),
'account' =>
array (
'account_password' =>
array (
'type' => 'password',
'label' => 'Account password',
'required' => true,
'placeholder' => 'Password',
),
),
'order' =>
array (
'order_comments' =>
array (
'type' => 'textarea',
'class' =>
array (
0 => 'notes',
),
'label' => 'Order notes',
'placeholder' => 'Notes about your order, e.g. special notes for delivery.',
),
),
'billing_first_name' =>
array (
'billing' =>
array (
'required' => false,
),
),
'billing_last_name' =>
array (
'billing' =>
array (
'required' => false,
),
),
'billing_city' =>
array (
'billing' =>
array (
'required' => false,
),
),
'billing_state' =>
array (
'billing' =>
array (
'required' => false,
),
),
'shipping_first_name' =>
array (
'shipping' =>
array (
'required' => false,
),
),
'shipping_last_name' =>
array (
'shipping' =>
array (
'required' => false,
),
),
'shipping_city' =>
array (
'shipping' =>
array (
'required' => false,
),
),
'shipping_state' =>
array (
'shipping' =>
array (
'required' => false,
),
),
)
[/code]
Related
- https://www.skyverge.com/blog/how-to-edit-required-woocommerce-checkout-fields/
- https://stackoverflow.com/questions/37791580/woocommerce-disabling-required-from-checkout-fields-with-a-filter-hook
- https://gist.github.com/corsonr/6129163
- https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
- https://wordpress.org/support/topic/want-to-disable-required-field-on-checkout-page/