Support » Plugin: Brazilian Market on WooCommerce » Campos obrigatórios

  • Como faço para colocar os campos, cep, endereço, cidade, estado como obrigatórios, os demais funcionaram.

    Os outros coloquei assim:

    add_filter( ‘woocommerce_billing_fields’, function( $fields ) {
    $fields[‘billing_neighborhood’][‘required’] = true;
    $fields[‘billing_cellphone’][‘required’] = true;
    $fields[‘billing_first_name’][‘required’] = true;
    $fields[‘billing_last_name’][‘required’] = true;
    return $fields;
    }, 20 );

Viewing 4 replies - 1 through 4 (of 4 total)
  • Billing Fields

    billing_first_name
    billing_last_name
    billing_company
    billing_country
    billing_address_1
    billing_address_2
    billing_city
    billing_state
    billing_postcode
    billing_phone
    billing_email

    $ fields [‘Billing Fields‘] [‘required’] = true; … No lugar de Billing Fields adicione o campo que quiser

    Realmente esses campos não mudam, não entendi pq.

    cep = billing_postcode

    endereço = billing_address_1
    billing_address_2

    cidade = billing_city

    estado = billing_state

    • This reply was modified 2 months, 1 week ago by dbk100.

    Tenta colocar separado…

    add_filter( ‘woocommerce_billing_fields’, ‘ts_require_wc_city_field’);
    function ts_require_wc_city_field( $fields ) {
    $fields[‘billing_city’][‘required’] = true;
    return $fields;
    }

    add_filter( ‘woocommerce_billing_fields’, ‘ts_require_wc_state_field’);
    function ts_require_wc_state_field( $fields ) {
    $fields[‘billing_state’][‘required’] = true;
    return $fields;
    }

    add_filter( ‘woocommerce_billing_fields’, ‘ts_require_wc_postcode_field’);
    function ts_require_wc_postcode_field( $fields ) {
    $fields[‘billing_postcode’][‘required’] = true;
    return $fields;
    }

    • This reply was modified 2 months, 1 week ago by dbk100.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.