Viewing 1 replies (of 1 total)
  • Hi q-styler.

    Sorry for my english

    I has the same trouble, you can solve this in this way:

    – First Remove the City input box from the form

    add_filter( 'woocommerce_checkout_fields' , 'override_checkout_fields' );
    
    // Our hooked in function - $fields is passed via the filter!
    function override_checkout_fields( $fields ) {
         unset($fields['billing']['billing_city']);
         unset($fields['shipping']['shipping_city']);
         return $fields;
    }

    – Second, make your own box with options

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields( $fields ) {
         $fields['billing']['billing_ciudad']= array(
        'type' => 'select',
        'label'     => __('Ciudad', 'woocommerce'),
        'placeholder'   => _x('San Salvador', 'placeholder', 'woocommerce'),
        'required'  => true,
        'class'     => array('form-row-wide'),
        'clear'     => true,
         );
         $fields['billing']['billing_ciudad']['options'] = array(
         	'option_1' => 'Col. Escalon',
      		'option_2' => 'Otro ciudad o colonia'
         	);
         return $fields;
    }

    You can see more on documentation:

    Here

Viewing 1 replies (of 1 total)
  • The topic ‘Limit by cities.’ is closed to new replies.