0

I have a Plugin has modify my city and address_1 for select city and select barangay.

Can you help me how can I find to delete data-allow_clear="true" in select option.

<select name="billing_city" id="billing_city" class="select state_select select2-hidden-accessible" autocomplete="address-level2" data-allow_clear="true" data-placeholder="Select a City" tabindex="-1" aria-hidden="true">

I dont know if theirs a missing code and how to find and add it to the Plugin file.

When customer registered, the city and address_1 registered in the data based is not showing or being cleared in checkout page.

The code I suspeciously cause it is: $this->loader->add_filter( 'woocommerce_checkout_get_value' , $plugin_admin, 'clear_checkout_fields' , 10, 2 );

in javascript file:

function clear_checkout_fields( $value, $input ){
    if( $input == 'select2-billing_state-container' )
        $value = '';
    
    return $value;

Another code that has .empty()

    $('body').on('change', '#billing_state', function(){
        var data = {
            action: "get_cities",
            province: $(this).val().split(' ').join('_'),
        };
        $.post('/wp-admin/admin-ajax.php', data, function(response) {
            $('#billing_city').empty();
            $('#billing_address_1').empty();
            
            var results = JSON.parse(response);

            $('#billing_city').append(
                $('<option></option>').val("").html("")                     
            );

            $.each(results, function(val) {
                $('#billing_city').append(
                    $('<option></option>').val(results[val]["name"]).html(results[val]["name"])
                );
            });
        });
    });

If you could helpe me identify why the data-allow_clear is true how can I can make it false?

Can you help me how the city details is not being cleared.

MEEY
  • 1
  • 1

0 Answers0