WooFill (v1.0) Documentation
Table of Contents
- Installation
- Usage
- Hooks for developers
A) Installation - top
WooFill for Woocommerce requires WordPress 3.8+ (may work on older version but has not been tested) and WooCommerce 2.0 or 2.1.
Just like every plugin, just copy the woofill folder in your wp-content/plugins folder then activate it through WordPress dashboard. If the installation went OK, the plugin is directly available on the checkout page of your site. There is no administration page.
B) Usage - top
- The plugin regroups and hides the components of the address : address_1, address_2, city, state, postcode, country.
- It adds a new "Address field" based on Google Places API.
- The user begins to type his address, Google completes it
- The user select his address
- The hidden fields are shown, automatically fielded with the Google's informations.
- NB: if the user chooses an address in a country which is not available in the WooCommerce settings, the fields are set to empty.
- Works for billing and shipping informations without conflict.
- Should works for every country (including non-latin alphabets and non-alphabetical languages). The format of the postal address varies for a country to another. We tried to make our plugin respect the formatting for every country.
C) Hooks for developers - top
a) Available filters
Nine filters are available for developers to manipulate default behavior of the plugin:
- woofill_billing_fields_to_group_filter: array of the billing form's element ids to group. Default: array('billing_address_1', 'billing_address_2', 'billing_city', 'billing_state', 'billing_postcode', 'billing_country')
- woofill_shipping_fields_to_group_filter: array of the shipping form's element ids to group. Default: array('shipping_address_1', 'shipping_address_2', 'shipping_city', 'shipping_state', 'shipping_postcode', 'shipping_country')
- woofill_use_css_filter: Whether to import or not the (light) default css. Default: true
- woofill_billing_address_not_found_label_filter: The text of the link "Addess not found ?" in billing form. Default: __('Address not found ?', 'woofill') (which means you can also use the po file included with the plugin to change this label)
- woofill_shipping_address_not_found_label_filter: The text of the link "Addess not found ?" in shipping form. Default: __('Address not found ?', 'woofill')
- woofill_billing_address_label_filter: The label for the added google autocomplete field (billing form). Default: __('Address ', 'woofill').'<abbr class="required" title="required">*</abbr>'
- woofill_shipping_address_label_filter: The label for the added google autocomplete field (shipping form). Default: __('Address ', 'woofill').'<abbr class="required" title="required">*</abbr>'
- woofill_billing_row_classes_filter: The classes applied to the paragraph around the added google autocomplete field (billing form). Default: array('form-row-wide', 'address-field')
- woofill_shipping_row_classes_filter: The classes applied to the paragraph around the added google autocomplete field (shipping form). Default: array('form-row-wide', 'address-field')
b) Usage examples
Disable the inclusion of the default css
// functions.php of the theme folder
function my_theme_woofill_use_css_filter($val)
{
return false;
}
add_filter('woofill_use_css_filter', 'my_theme_woofill_use_css_filter');
Changing the order of the fields inside the grouped fields for billing address (putting country first)
// functions.php of the theme folder
function my_theme_woofill_billing_fields_to_group_filter($array)
{
return array('billing_country', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_state', 'billing_postcode');
}
add_filter('woofill_billing_fields_to_group_filter', 'my_theme_woofill_billing_fields_to_group_filter');
Adding a custom (but already defined) shipping_address_3 to the grouped fields for shipping address
// functions.php of the theme folder
function my_theme_woofill_shipping_fields_to_group_filter($array)
{
array('shipping_address_1', 'shipping_address_2' , 'shipping_address_3', 'shipping_city', 'shipping_state', 'shipping_postcode', 'shipping_country');
}
add_filter('woofill_shipping_fields_to_group_filter', 'my_theme_woofill_shipping_fields_to_group_filter');
Renaming the 'address not found?' link in the billing form
// functions.php of the theme folder
function my_theme_woofill_billing_address_not_found_label_filter($label)
{
return 'My new label';
}
add_filter('woofill_billing_address_not_found_label_filter', 'my_theme_woofill_billing_address_not_found_label_filter');
Go To Table of Contents