\nvar AddressFinderConfig = {};\n"; if($af_key_nz) { echo "AddressFinderConfig.key_nz = '{$af_key_nz}';\n"; } if($af_key_au) { echo "AddressFinderConfig.key_au = '{$af_key_au}';\n"; } if ($af_widget_options) { $encoded_json = json_encode($af_widget_options); echo "AddressFinderConfig.widget_options = {$encoded_json};\n"; } if($af_debug == 'yes') { echo "AddressFinderConfig.debug = true;\n"; } echo "\n{$addressfinder_js}\n"; } add_filter( 'woocommerce_get_settings_checkout', 'addressfinder_settings', 10, 1 ); function addressfinder_settings( $settings ) { $settings[] = array( 'name' => __( 'AddressFinder Settings', 'text-domain' ), 'type' => 'title', 'desc' => __( 'AddressFinder supports New Zealand and Australia. You may enter a key for either, or both.', 'text-domain' ), 'id' => 'addressfinder-widget' ); $settings[] = array( 'name' => __( 'Key for New Zealand', 'text-domain' ), 'desc_tip' => __( 'The Key shown in the AddressFinder portal', 'text-domain' ), 'id' => 'af-key', 'type' => 'text', 'desc' => __( 'Find your AddressFinder Key from AddressFinder Portal', 'text-domain' ), ); $settings[] = array( 'name' => __( 'Key for Australia', 'text-domain' ), 'desc_tip' => __( 'The Key shown in the AddressFinder Australian portal', 'text-domain' ), 'id' => 'af-key-au', 'type' => 'text', 'desc' => __( 'Find your AddressFinder Key from AddressFinder Portal', 'text-domain' ), ); $settings[] = array( 'name' => __( 'Widget Options', 'text-domain' ), 'id' => 'af-widget-options', 'type' => 'textarea', 'placeholder' => __('Eg: {"byline": true}', 'text-domain'), 'desc' => __('

Additional options that allow you to adjust the default behaviour of the widget. These options should be in the form of a JSON string with proper quoting of keys.

This section may be left blank for default behaviour.

For a full list of possible options see our Widget documentation

', 'text-domain'), ); $settings[] = array( 'name' => __( 'Debug Mode', 'text-domain' ), 'id' => 'af-debug', 'type' => 'checkbox', 'desc' => __( 'Show error messages when expected fields are missing', 'text-domain' ), ); $settings[] = array( 'type' => 'sectionend', 'id' => 'addressfinder-widget' ); return $settings; } } ?>