Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Works with WooCommerce Google Autocomplete since version 1.12 */
- /* It assumes that your theme (or a plugin) is adding specific fields for the netherlands/brazilian addresses ; at least one for the street name and one for the house number */
- /* You just have to paste this code to your functions.php theme file.
- You have to change, if different, the names of the fields:
- - billing_street_name
- - billing_house_number
- - billing_house_number_suffix (not mandatory, just to group it with the other fields if you have this field, used for NL addresses)
- – billing_bairro (not mandatory, can be used for brazilian addresses)
- - shipping_street_name
- - shipping_house_number
- - shipping_house_number_suffix (not mandatory)
- – shipping_bairro (not mandatory)
- */
- add_filter('woogoogad_countries_with_additional_fields', 'my_countries_with_specific_street_number_handeling');
- function my_countries_with_specific_street_number_handeling()
- {
- //country codes for the countries where you want to separate the house number from the route name.
- return array('NL', 'BR');
- }
- add_filter('woogoogad_additional_fields', 'my_additional_fields_with_street_number');
- function my_additional_fields_with_street_number()
- {
- return array('billing' => array(
- 'street_name' => 'billing_street_name', //edit the name or billing_address_1 to use the native field
- 'house_number' => 'billing_house_number', //edit the name
- 'house_number_suffix' => 'billing_house_number_suffix', //optional, for NL addresses. Edit the name if needed
- 'bairro' => 'billing_bairro' //optional, the neighborhood field for BR addresses
- ),
- 'shipping' => array(
- 'street_name' => 'shipping_street_name', //edit the name or shipping_address_1 to use the native field
- 'house_number' => 'shipping_house_number', //edit the name
- 'house_number_suffix' => 'shipping_house_number_suffix', //optional, for NL addresses. Edit the name if needed
- 'bairro' => 'shipping_bairro' //optional, the neighborhood field for BR addresses
- )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement