Hooks and filters

Change one behaviour, or take over the WooCommerce fields entirely. All hooks are part of the stable public API.

Actions

ActionWhen
vafw_loadedThe plugin has loaded. Receives the API version (1).

Filters

FilterWhat it changes
vafw_settingsThe settings in use: picker, strict, hide_postcode, reorder, rest (1 / 0).
vafw_woocommerce_enabledReturn false to handle the WooCommerce address fields yourself.
vafw_find_wardThe ward found for what was typed: ( $ward, $province, $text ). Also used by checkout validation.
vafw_address_formatThe Vietnamese address format (WooCommerce placeholders).
vafw_load_pickerWhether to load the picker on the current page (default: checkout, cart and My Account).
vafw_rest_enabledTurn the REST API on or off.
vafw_data_dir, vafw_data_urlWhere the JSON data is read from — for example a copy kept outside the plugin folder.

Examples

Keep the postcode visible

add_filter( 'vafw_settings', function ( $settings ) {
    $settings['hide_postcode'] = 0;
    return $settings;
} );

Turn off the REST API

add_filter( 'vafw_rest_enabled', '__return_false' );

Load the picker on a custom page

add_filter( 'vafw_load_picker', function ( $load ) {
    return $load || is_page( 'order-form' );
} );