WooCommerce Extra Checkout Fields for Brazil - Version 3.4.4

Version Description

  • 2016/06/20 =

  • Adicionado suporte a nova API REST do WooCommerce.

  • Corrigido localizao do campo de CEP na pgina de editar endereos.

  • Corrigido os campos de bairro e nmero no mtodo WC_Order::get_order_address().

  • Adicionada compatibilidade com o WooCommerce Correios 3.0.0.

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce Extra Checkout Fields for Brazil
Version 3.4.4
Comparing to
See all releases

Code changes from version 3.4.3 to 3.4.4

assets/js/frontend/frontend.js CHANGED
@@ -219,7 +219,7 @@ jQuery( function( $ ) {
219
  },
220
 
221
  addressAutoCompleteOnChange: function( field ) {
222
- $( '#' + field + '_postcode' ).on( 'blur', function () {
223
  wc_ecfb_frontend.addressAutoComplete( field );
224
  });
225
  }
219
  },
220
 
221
  addressAutoCompleteOnChange: function( field ) {
222
+ $( document.body ).on( 'blur', '#' + field + '_postcode', function() {
223
  wc_ecfb_frontend.addressAutoComplete( field );
224
  });
225
  }
assets/js/frontend/frontend.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){var b={init:function(){a(document.body).on("country_to_state_changing",this.country_to_state_changing),"0"!==wcbcf_public_params.person_type&&this.person_type_fields(),"yes"===wcbcf_public_params.maskedinput&&(a(document.body).on("change","#billing_country",function(){"BR"===a(this).val()?b.maskBilling():b.unmaskBilling()}),a(document.body).on("change","#shipping_country",function(){"BR"===a(this).val()?b.maskShipping():b.unmaskShipping()}),this.maskGeneral()),"yes"===wcbcf_public_params.mailcheck&&this.emailCheck(),"yes"===wcbcf_public_params.addresscomplete&&(this.addressAutoComplete("billing"),this.addressAutoCompleteOnChange("billing"),this.addressAutoComplete("shipping"),this.addressAutoCompleteOnChange("shipping"))},country_to_state_changing:function(){a("#billing_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#billing_postcode_field").insertAfter("#billing_country_field"),a("#shipping_state_field").length&&(a("#shipping_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#shipping_postcode_field").insertAfter("#shipping_country_field"))},person_type_fields:function(){"no"===wcbcf_public_params.only_brazil?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):a("#billing_country").on("change",function(){var b=a(this).val();"BR"===b?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):(a(".person-type-field").removeClass("validate-required"),a(".person-type-field label abbr").remove())}).change(),"1"===wcbcf_public_params.person_type&&a("#billing_persontype").on("change",function(){var b=a(this).val();a("#billing_cpf_field").hide(),a("#billing_rg_field").hide(),a("#billing_company_field").hide(),a("#billing_cnpj_field").hide(),a("#billing_ie_field").hide(),"1"===b&&(a("#billing_cpf_field").show(),a("#billing_rg_field").show()),"2"===b&&(a("#billing_company_field").show(),a("#billing_cnpj_field").show(),a("#billing_ie_field").show())}).change()},maskBilling:function(){a("#billing_phone, #billing_cellphone").focusout(b.maskPhone).trigger("focusout"),a("#billing_birthdate").mask("99/99/9999"),a("#billing_postcode").mask("99999-999")},unmaskBilling:function(){a("#billing_phone, #billing_cellphone, #billing_birthdate, #billing_postcode").unmask()},maskShipping:function(){a("#shipping_postcode").mask("99999-999")},unmaskShipping:function(){a("#shipping_postcode").unmask()},maskGeneral:function(){a("#billing_cpf, #credit-card-cpf").mask("999.999.999-99"),a("#billing_cnpj").mask("99.999.999/9999-99"),a("#credit-card-phone").focusout(b.maskPhone).trigger("focusout")},maskPhone:function(){var b,c;c=a(this),c.unmask(),b=c.val().replace(/\D/g,""),b.length>10?c.mask("(99) 99999-999?9"):c.mask("(99) 9999-9999?9")},emailCheck:function(){a("#wcbcf-mailsuggest").length<1&&a("#billing_email").after('<div id="wcbcf-mailsuggest"></div>'),a("#billing_email").on("blur",function(){a("#wcbcf-mailsuggest").html(""),a(this).mailcheck({suggested:function(b,c){a("#wcbcf-mailsuggest").html("Você quis dizer: "+c.full+"?")}})}),a("#wcbcf-mailsuggest").css({color:"#c00",fontSize:"small"})},addressAutoComplete:function(b){if(a("#"+b+"_postcode").length){var c=a("#"+b+"_postcode").val().replace(".","").replace("-",""),d=a("#"+b+"_country").val(),e=a("#"+b+"_address_1").val();""!==c&&8===c.length&&"BR"===d&&0===e.length&&a.ajax({type:"GET",url:"//correiosapi.apphb.com/cep/"+c,dataType:"jsonp",crossDomain:!0,contentType:"application/json",success:function(c){""!==c.tipoDeLogradouro?a("#"+b+"_address_1").val(c.tipoDeLogradouro+" "+c.logradouro).change():a("#"+b+"_address_1").val(c.logradouro).change(),a("#"+b+"_neighborhood").val(c.bairro).change(),a("#"+b+"_city").val(c.cidade).change(),a("#"+b+"_state option:selected").attr("selected",!1).change(),a("#"+b+'_state option[value="'+c.estado+'"]').attr("selected","selected").change(),a("#"+b+"_state").trigger("liszt:updated").trigger("chosen:updated")}})}},addressAutoCompleteOnChange:function(c){a("#"+c+"_postcode").on("blur",function(){b.addressAutoComplete(c)})}};b.init()});
1
+ jQuery(function(a){var b={init:function(){a(document.body).on("country_to_state_changing",this.country_to_state_changing),"0"!==wcbcf_public_params.person_type&&this.person_type_fields(),"yes"===wcbcf_public_params.maskedinput&&(a(document.body).on("change","#billing_country",function(){"BR"===a(this).val()?b.maskBilling():b.unmaskBilling()}),a(document.body).on("change","#shipping_country",function(){"BR"===a(this).val()?b.maskShipping():b.unmaskShipping()}),this.maskGeneral()),"yes"===wcbcf_public_params.mailcheck&&this.emailCheck(),"yes"===wcbcf_public_params.addresscomplete&&(this.addressAutoComplete("billing"),this.addressAutoCompleteOnChange("billing"),this.addressAutoComplete("shipping"),this.addressAutoCompleteOnChange("shipping"))},country_to_state_changing:function(){a("#billing_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#billing_postcode_field").insertAfter("#billing_country_field"),a("#shipping_state_field").length&&(a("#shipping_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#shipping_postcode_field").insertAfter("#shipping_country_field"))},person_type_fields:function(){"no"===wcbcf_public_params.only_brazil?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):a("#billing_country").on("change",function(){var b=a(this).val();"BR"===b?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):(a(".person-type-field").removeClass("validate-required"),a(".person-type-field label abbr").remove())}).change(),"1"===wcbcf_public_params.person_type&&a("#billing_persontype").on("change",function(){var b=a(this).val();a("#billing_cpf_field").hide(),a("#billing_rg_field").hide(),a("#billing_company_field").hide(),a("#billing_cnpj_field").hide(),a("#billing_ie_field").hide(),"1"===b&&(a("#billing_cpf_field").show(),a("#billing_rg_field").show()),"2"===b&&(a("#billing_company_field").show(),a("#billing_cnpj_field").show(),a("#billing_ie_field").show())}).change()},maskBilling:function(){a("#billing_phone, #billing_cellphone").focusout(b.maskPhone).trigger("focusout"),a("#billing_birthdate").mask("99/99/9999"),a("#billing_postcode").mask("99999-999")},unmaskBilling:function(){a("#billing_phone, #billing_cellphone, #billing_birthdate, #billing_postcode").unmask()},maskShipping:function(){a("#shipping_postcode").mask("99999-999")},unmaskShipping:function(){a("#shipping_postcode").unmask()},maskGeneral:function(){a("#billing_cpf, #credit-card-cpf").mask("999.999.999-99"),a("#billing_cnpj").mask("99.999.999/9999-99"),a("#credit-card-phone").focusout(b.maskPhone).trigger("focusout")},maskPhone:function(){var b,c;c=a(this),c.unmask(),b=c.val().replace(/\D/g,""),b.length>10?c.mask("(99) 99999-999?9"):c.mask("(99) 9999-9999?9")},emailCheck:function(){a("#wcbcf-mailsuggest").length<1&&a("#billing_email").after('<div id="wcbcf-mailsuggest"></div>'),a("#billing_email").on("blur",function(){a("#wcbcf-mailsuggest").html(""),a(this).mailcheck({suggested:function(b,c){a("#wcbcf-mailsuggest").html("Você quis dizer: "+c.full+"?")}})}),a("#wcbcf-mailsuggest").css({color:"#c00",fontSize:"small"})},addressAutoComplete:function(b){if(a("#"+b+"_postcode").length){var c=a("#"+b+"_postcode").val().replace(".","").replace("-",""),d=a("#"+b+"_country").val(),e=a("#"+b+"_address_1").val();""!==c&&8===c.length&&"BR"===d&&0===e.length&&a.ajax({type:"GET",url:"//correiosapi.apphb.com/cep/"+c,dataType:"jsonp",crossDomain:!0,contentType:"application/json",success:function(c){""!==c.tipoDeLogradouro?a("#"+b+"_address_1").val(c.tipoDeLogradouro+" "+c.logradouro).change():a("#"+b+"_address_1").val(c.logradouro).change(),a("#"+b+"_neighborhood").val(c.bairro).change(),a("#"+b+"_city").val(c.cidade).change(),a("#"+b+"_state option:selected").attr("selected",!1).change(),a("#"+b+'_state option[value="'+c.estado+'"]').attr("selected","selected").change(),a("#"+b+"_state").trigger("liszt:updated").trigger("chosen:updated")}})}},addressAutoCompleteOnChange:function(c){a(document.body).on("blur","#"+c+"_postcode",function(){b.addressAutoComplete(c)})}};b.init()});
includes/admin/class-wc-ecfb-settings.php CHANGED
@@ -178,18 +178,20 @@ class Extra_Checkout_Fields_For_Brazil_Settings {
178
  );
179
 
180
  // Address Autocomplete option.
181
- add_settings_field(
182
- 'addresscomplete',
183
- __( 'Enable Address Autocomplete:', 'woocommerce-extra-checkout-fields-for-brazil' ),
184
- array( $this, 'checkbox_element_callback' ),
185
- $option,
186
- 'jquery_section',
187
- array(
188
- 'menu' => $option,
189
- 'id' => 'addresscomplete',
190
- 'label' => __( 'If checked automatically complete the address fields based on the zip code.', 'woocommerce-extra-checkout-fields-for-brazil' )
191
- )
192
- );
 
 
193
 
194
  // Set Custom Fields cection.
195
  add_settings_section(
178
  );
179
 
180
  // Address Autocomplete option.
181
+ if ( ! apply_filters( 'woocommerce_correios_enable_autofill_addresses', false ) ) {
182
+ add_settings_field(
183
+ 'addresscomplete',
184
+ __( 'Enable Address Autocomplete:', 'woocommerce-extra-checkout-fields-for-brazil' ),
185
+ array( $this, 'checkbox_element_callback' ),
186
+ $option,
187
+ 'jquery_section',
188
+ array(
189
+ 'menu' => $option,
190
+ 'id' => 'addresscomplete',
191
+ 'label' => __( 'If checked automatically complete the address fields based on the zip code.', 'woocommerce-extra-checkout-fields-for-brazil' ),
192
+ )
193
+ );
194
+ }
195
 
196
  // Set Custom Fields cection.
197
  add_settings_section(
includes/class-wc-ecfb-api.php CHANGED
@@ -12,8 +12,15 @@ class Extra_Checkout_Fields_For_Brazil_API {
12
  * Initialize integrations.
13
  */
14
  public function __construct() {
15
- add_filter( 'woocommerce_api_order_response', array( $this, 'orders' ), 100, 4 );
16
- add_filter( 'woocommerce_api_customer_response', array( $this, 'customer' ), 100, 4 );
 
 
 
 
 
 
 
17
  }
18
 
19
  /**
@@ -28,14 +35,14 @@ class Extra_Checkout_Fields_For_Brazil_API {
28
  }
29
 
30
  /**
31
- * Get formatted birthdate.
32
  *
33
  * @param string $date
34
  * @param WC_API_Server $server
35
  *
36
  * @return string
37
  */
38
- protected function get_formatted_birthdate( $date, $server ) {
39
  $birthdate = explode( '/', $date );
40
 
41
  if ( isset( $birthdate[1] ) && ! empty( $birthdate[1] ) ) {
@@ -45,6 +52,24 @@ class Extra_Checkout_Fields_For_Brazil_API {
45
  return '';
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
  * Get person type.
50
  *
@@ -75,7 +100,7 @@ class Extra_Checkout_Fields_For_Brazil_API {
75
  }
76
 
77
  /**
78
- * Add extra fields in order API.
79
  *
80
  * @param array $order_data
81
  * @param WC_Order $order
@@ -84,7 +109,7 @@ class Extra_Checkout_Fields_For_Brazil_API {
84
  *
85
  * @return array
86
  */
87
- public function orders( $order_data, $order, $fields, $server ) {
88
 
89
  // Billing fields.
90
  $order_data['billing_address']['persontype'] = $this->get_person_type( $order->billing_persontype );
@@ -92,7 +117,7 @@ class Extra_Checkout_Fields_For_Brazil_API {
92
  $order_data['billing_address']['rg'] = $this->format_number( $order->billing_rg );
93
  $order_data['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
94
  $order_data['billing_address']['ie'] = $this->format_number( $order->billing_ie );
95
- $order_data['billing_address']['birthdate'] = $this->get_formatted_birthdate( $order->billing_birthdate, $server );
96
  $order_data['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
97
  $order_data['billing_address']['number'] = $order->billing_number;
98
  $order_data['billing_address']['neighborhood'] = $order->billing_neighborhood;
@@ -110,7 +135,7 @@ class Extra_Checkout_Fields_For_Brazil_API {
110
  $order_data['customer']['billing_address']['rg'] = $this->format_number( $order->billing_rg );
111
  $order_data['customer']['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
112
  $order_data['customer']['billing_address']['ie'] = $this->format_number( $order->billing_ie );
113
- $order_data['customer']['billing_address']['birthdate'] = $this->get_formatted_birthdate( $order->billing_birthdate, $server );
114
  $order_data['customer']['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
115
  $order_data['customer']['billing_address']['number'] = $order->billing_number;
116
  $order_data['customer']['billing_address']['neighborhood'] = $order->billing_neighborhood;
@@ -129,7 +154,7 @@ class Extra_Checkout_Fields_For_Brazil_API {
129
  }
130
 
131
  /**
132
- * Add extra fields in customer API.
133
  *
134
  * @param array $customer_data
135
  * @param WC_Order $customer
@@ -138,14 +163,14 @@ class Extra_Checkout_Fields_For_Brazil_API {
138
  *
139
  * @return array
140
  */
141
- public function customer( $customer_data, $customer, $fields, $server ) {
142
  // Billing fields.
143
  $customer_data['billing_address']['persontype'] = $this->get_person_type( $customer->billing_persontype );
144
  $customer_data['billing_address']['cpf'] = $this->format_number( $customer->billing_cpf );
145
  $customer_data['billing_address']['rg'] = $this->format_number( $customer->billing_rg );
146
  $customer_data['billing_address']['cnpj'] = $this->format_number( $customer->billing_cnpj );
147
  $customer_data['billing_address']['ie'] = $this->format_number( $customer->billing_ie );
148
- $customer_data['billing_address']['birthdate'] = $this->get_formatted_birthdate( $customer->billing_birthdate, $server );
149
  $customer_data['billing_address']['sex'] = substr( $customer->billing_sex, 0, 1 );
150
  $customer_data['billing_address']['number'] = $customer->billing_number;
151
  $customer_data['billing_address']['neighborhood'] = $customer->billing_neighborhood;
@@ -161,6 +186,134 @@ class Extra_Checkout_Fields_For_Brazil_API {
161
 
162
  return $customer_data;
163
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
 
166
  new Extra_Checkout_Fields_For_Brazil_API();
12
  * Initialize integrations.
13
  */
14
  public function __construct() {
15
+ // Legacy REST API.
16
+ add_filter( 'woocommerce_api_order_response', array( $this, 'legacy_orders_response' ), 100, 4 );
17
+ add_filter( 'woocommerce_api_customer_response', array( $this, 'legacy_customers_response' ), 100, 4 );
18
+
19
+ // WP REST API.
20
+ add_filter( 'woocommerce_rest_prepare_customer', array( $this, 'customers_response' ), 100, 2 );
21
+ add_filter( 'woocommerce_rest_prepare_shop_order', array( $this, 'orders_response' ), 100, 2 );
22
+ add_filter( 'woocommerce_rest_customer_schema', array( $this, 'addresses_schema' ), 100 );
23
+ add_filter( 'woocommerce_rest_shop_order_schema', array( $this, 'addresses_schema' ), 100 );
24
  }
25
 
26
  /**
35
  }
36
 
37
  /**
38
+ * Get formatted birthdate legacy.
39
  *
40
  * @param string $date
41
  * @param WC_API_Server $server
42
  *
43
  * @return string
44
  */
45
+ protected function get_formatted_birthdate_legacy( $date, $server ) {
46
  $birthdate = explode( '/', $date );
47
 
48
  if ( isset( $birthdate[1] ) && ! empty( $birthdate[1] ) ) {
52
  return '';
53
  }
54
 
55
+ /**
56
+ * Get formatted birthdate.
57
+ *
58
+ * @param string $date
59
+ * @param WC_API_Server $server
60
+ *
61
+ * @return string
62
+ */
63
+ protected function get_formatted_birthdate( $date ) {
64
+ $birthdate = explode( '/', $date );
65
+
66
+ if ( isset( $birthdate[1] ) && ! empty( $birthdate[1] ) ) {
67
+ return sprintf( '%s-%s-%sT00:00:00', $birthdate[1], $birthdate[0], $birthdate[2] );
68
+ }
69
+
70
+ return '';
71
+ }
72
+
73
  /**
74
  * Get person type.
75
  *
100
  }
101
 
102
  /**
103
+ * Add extra fields in legacy order response.
104
  *
105
  * @param array $order_data
106
  * @param WC_Order $order
109
  *
110
  * @return array
111
  */
112
+ public function legacy_orders_response( $order_data, $order, $fields, $server ) {
113
 
114
  // Billing fields.
115
  $order_data['billing_address']['persontype'] = $this->get_person_type( $order->billing_persontype );
117
  $order_data['billing_address']['rg'] = $this->format_number( $order->billing_rg );
118
  $order_data['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
119
  $order_data['billing_address']['ie'] = $this->format_number( $order->billing_ie );
120
+ $order_data['billing_address']['birthdate'] = $this->get_formatted_birthdate_legacy( $order->billing_birthdate, $server );
121
  $order_data['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
122
  $order_data['billing_address']['number'] = $order->billing_number;
123
  $order_data['billing_address']['neighborhood'] = $order->billing_neighborhood;
135
  $order_data['customer']['billing_address']['rg'] = $this->format_number( $order->billing_rg );
136
  $order_data['customer']['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
137
  $order_data['customer']['billing_address']['ie'] = $this->format_number( $order->billing_ie );
138
+ $order_data['customer']['billing_address']['birthdate'] = $this->get_formatted_birthdate_legacy( $order->billing_birthdate, $server );
139
  $order_data['customer']['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
140
  $order_data['customer']['billing_address']['number'] = $order->billing_number;
141
  $order_data['customer']['billing_address']['neighborhood'] = $order->billing_neighborhood;
154
  }
155
 
156
  /**
157
+ * Add extra fields in legacy customers response.
158
  *
159
  * @param array $customer_data
160
  * @param WC_Order $customer
163
  *
164
  * @return array
165
  */
166
+ public function legacy_customers_response( $customer_data, $customer, $fields, $server ) {
167
  // Billing fields.
168
  $customer_data['billing_address']['persontype'] = $this->get_person_type( $customer->billing_persontype );
169
  $customer_data['billing_address']['cpf'] = $this->format_number( $customer->billing_cpf );
170
  $customer_data['billing_address']['rg'] = $this->format_number( $customer->billing_rg );
171
  $customer_data['billing_address']['cnpj'] = $this->format_number( $customer->billing_cnpj );
172
  $customer_data['billing_address']['ie'] = $this->format_number( $customer->billing_ie );
173
+ $customer_data['billing_address']['birthdate'] = $this->get_formatted_birthdate_legacy( $customer->billing_birthdate, $server );
174
  $customer_data['billing_address']['sex'] = substr( $customer->billing_sex, 0, 1 );
175
  $customer_data['billing_address']['number'] = $customer->billing_number;
176
  $customer_data['billing_address']['neighborhood'] = $customer->billing_neighborhood;
186
 
187
  return $customer_data;
188
  }
189
+
190
+ /**
191
+ * Add extra fields in customers response.
192
+ *
193
+ * @param WP_REST_Response $response The response object.
194
+ * @param WP_User $customer User object used to create response.
195
+ * @param WP_REST_Request $request Request object.
196
+ *
197
+ * @return WP_REST_Response
198
+ */
199
+ public function customers_response( $response, $customer ) {
200
+ // Billing fields.
201
+ $response->data['billing']['number'] = $customer->billing_number;
202
+ $response->data['billing']['neighborhood'] = $customer->billing_neighborhood;
203
+ $response->data['billing']['persontype'] = $this->get_person_type( $customer->billing_persontype );
204
+ $response->data['billing']['cpf'] = $this->format_number( $customer->billing_cpf );
205
+ $response->data['billing']['rg'] = $this->format_number( $customer->billing_rg );
206
+ $response->data['billing']['cnpj'] = $this->format_number( $customer->billing_cnpj );
207
+ $response->data['billing']['ie'] = $this->format_number( $customer->billing_ie );
208
+ $response->data['billing']['birthdate'] = $this->get_formatted_birthdate( $customer->billing_birthdate );
209
+ $response->data['billing']['sex'] = substr( $customer->billing_sex, 0, 1 );
210
+ $response->data['billing']['cellphone'] = $customer->billing_cellphone;
211
+
212
+ // Shipping fields.
213
+ $response->data['shipping']['number'] = $customer->shipping_number;
214
+ $response->data['shipping']['neighborhood'] = $customer->shipping_neighborhood;
215
+
216
+ return $response;
217
+ }
218
+
219
+ /**
220
+ * Add extra fields in orders response.
221
+ *
222
+ * @param WP_REST_Response $response The response object.
223
+ * @param WP_Post $post Post object.
224
+ *
225
+ * @return WP_REST_Response
226
+ */
227
+ public function orders_response( $response, $post ) {
228
+ // Billing fields.
229
+ $response->data['billing']['number'] = get_post_meta( $post->ID, '_billing_number', true );
230
+ $response->data['billing']['neighborhood'] = get_post_meta( $post->ID, '_billing_neighborhood', true );
231
+ $response->data['billing']['persontype'] = $this->get_person_type( get_post_meta( $post->ID, '_billing_persontype', true ) );
232
+ $response->data['billing']['cpf'] = $this->format_number( get_post_meta( $post->ID, '_billing_cpf', true ) );
233
+ $response->data['billing']['rg'] = $this->format_number( get_post_meta( $post->ID, '_billing_rg', true ) );
234
+ $response->data['billing']['cnpj'] = $this->format_number( get_post_meta( $post->ID, '_billing_cnpj', true ) );
235
+ $response->data['billing']['ie'] = $this->format_number( get_post_meta( $post->ID, '_billing_ie', true ) );
236
+ $response->data['billing']['birthdate'] = $this->get_formatted_birthdate( get_post_meta( $post->ID, '_billing_birthdate', true ) );
237
+ $response->data['billing']['sex'] = substr( get_post_meta( $post->ID, '_billing_sex', true ), 0, 1 );
238
+ $response->data['billing']['cellphone'] = get_post_meta( $post->ID, '_billing_cellphone', true );
239
+
240
+ // Shipping fields.
241
+ $response->data['shipping']['number'] = get_post_meta( $post->ID, '_shipping_number', true );
242
+ $response->data['shipping']['neighborhood'] = get_post_meta( $post->ID, '_shipping_neighborhood', true );
243
+
244
+ return $response;
245
+ }
246
+
247
+ /**
248
+ * Addresses schena.
249
+ *
250
+ * @param array $schema Default schema properties.
251
+ * @return array
252
+ */
253
+ public function addresses_schema( $properties ) {
254
+ $properties['billing']['properties']['number'] = array(
255
+ 'description' => __( 'Number.', 'woocommerce-extra-checkout-fields-for-brazil' ),
256
+ 'type' => 'string',
257
+ 'context' => array( 'view', 'edit' ),
258
+ );
259
+ $properties['billing']['properties']['neighborhood'] = array(
260
+ 'description' => __( 'Neighborhood.', 'woocommerce-extra-checkout-fields-for-brazil' ),
261
+ 'type' => 'string',
262
+ 'context' => array( 'view', 'edit' ),
263
+ );
264
+ $properties['billing']['properties']['persontype'] = array(
265
+ 'description' => __( 'Person type.', 'woocommerce-extra-checkout-fields-for-brazil' ),
266
+ 'type' => 'string',
267
+ 'context' => array( 'view', 'edit' ),
268
+ );
269
+ $properties['billing']['properties']['cpf'] = array(
270
+ 'description' => __( 'CPF.', 'woocommerce-extra-checkout-fields-for-brazil' ),
271
+ 'type' => 'string',
272
+ 'context' => array( 'view', 'edit' ),
273
+ );
274
+ $properties['billing']['properties']['rg'] = array(
275
+ 'description' => __( 'RG.', 'woocommerce-extra-checkout-fields-for-brazil' ),
276
+ 'type' => 'string',
277
+ 'context' => array( 'view', 'edit' ),
278
+ );
279
+ $properties['billing']['properties']['cnpj'] = array(
280
+ 'description' => __( 'CNPJ.', 'woocommerce-extra-checkout-fields-for-brazil' ),
281
+ 'type' => 'string',
282
+ 'context' => array( 'view', 'edit' ),
283
+ );
284
+ $properties['billing']['properties']['ie'] = array(
285
+ 'description' => __( 'IE.', 'woocommerce-extra-checkout-fields-for-brazil' ),
286
+ 'type' => 'string',
287
+ 'context' => array( 'view', 'edit' ),
288
+ );
289
+ $properties['billing']['properties']['birthdate'] = array(
290
+ 'description' => __( 'Birthdate.', 'woocommerce-extra-checkout-fields-for-brazil' ),
291
+ 'type' => 'string',
292
+ 'context' => array( 'view', 'edit' ),
293
+ );
294
+ $properties['billing']['properties']['sex'] = array(
295
+ 'description' => __( 'Gender.', 'woocommerce-extra-checkout-fields-for-brazil' ),
296
+ 'type' => 'string',
297
+ 'context' => array( 'view', 'edit' ),
298
+ );
299
+ $properties['billing']['properties']['cellphone'] = array(
300
+ 'description' => __( 'Cell Phone.', 'woocommerce-extra-checkout-fields-for-brazil' ),
301
+ 'type' => 'string',
302
+ 'context' => array( 'view', 'edit' ),
303
+ );
304
+ $properties['shipping']['properties']['number'] = array(
305
+ 'description' => __( 'Number.', 'woocommerce-extra-checkout-fields-for-brazil' ),
306
+ 'type' => 'string',
307
+ 'context' => array( 'view', 'edit' ),
308
+ );
309
+ $properties['shipping']['properties']['neighborhood'] = array(
310
+ 'description' => __( 'Neighborhood.', 'woocommerce-extra-checkout-fields-for-brazil' ),
311
+ 'type' => 'string',
312
+ 'context' => array( 'view', 'edit' ),
313
+ );
314
+
315
+ return $properties;
316
+ }
317
  }
318
 
319
  new Extra_Checkout_Fields_For_Brazil_API();
includes/class-wc-ecfb-front-end.php CHANGED
@@ -15,12 +15,14 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
15
  // Load custom order data.
16
  add_filter( 'woocommerce_load_order_data', array( $this, 'load_order_data' ) );
17
 
18
- // Load public-facing style sheet and JavaScript.
19
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
 
20
 
21
  // New checkout fields.
22
- add_filter( 'woocommerce_billing_fields', array( $this, 'checkout_billing_fields' ) );
23
- add_filter( 'woocommerce_shipping_fields', array( $this, 'checkout_shipping_fields' ) );
24
 
25
  // Valid checkout fields.
26
  add_action( 'woocommerce_checkout_process', array( $this, 'valid_checkout_fields' ) );
@@ -65,7 +67,7 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
65
  }
66
 
67
  /**
68
- * Register and enqueues public-facing style sheet and JavaScript files.
69
  */
70
  public function enqueue_scripts() {
71
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@@ -74,28 +76,30 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
74
 
75
  wp_register_script( 'mailcheck', plugins_url( 'assets/js/mailcheck/mailcheck' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), '1.1.1', true );
76
 
77
- // Load scripts only in checkout.
78
- if ( is_checkout() || is_account_page() ) {
79
-
80
- // Get plugin settings.
81
- $settings = get_option( 'wcbcf_settings' );
82
- $autofill = isset( $settings['addresscomplete'] ) ? 'yes' : 'no';
83
-
84
- wp_enqueue_script( 'woocommerce-extra-checkout-fields-for-brazil-front', plugins_url( 'assets/js/frontend/frontend' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'jquery-maskedinput', 'mailcheck' ), Extra_Checkout_Fields_For_Brazil::VERSION, true );
85
- wp_localize_script(
86
- 'woocommerce-extra-checkout-fields-for-brazil-front',
87
- 'wcbcf_public_params',
88
- array(
89
- 'state' => esc_js( __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
90
- 'required' => esc_js( __( 'required', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
91
- 'mailcheck' => isset( $settings['mailcheck'] ) ? 'yes' : 'no',
92
- 'maskedinput' => isset( $settings['maskedinput'] ) ? 'yes' : 'no',
93
- 'addresscomplete' => class_exists( 'WC_Autofill_Brazilian_Addresses' ) ? false : $autofill,
94
- 'person_type' => absint( $settings['person_type'] ),
95
- 'only_brazil' => isset( $settings['only_brazil'] ) ? 'yes' : 'no'
96
- )
97
- );
98
- }
 
 
99
  }
100
 
101
  /**
@@ -106,32 +110,22 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
106
  * @return array New fields.
107
  */
108
  public function checkout_billing_fields( $fields ) {
109
-
110
  $new_fields = array();
111
 
112
  // Get plugin settings.
113
  $settings = get_option( 'wcbcf_settings' );
114
 
115
- // Billing First Name.
116
- $new_fields['billing_first_name'] = array(
117
- 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
118
- 'placeholder' => _x( 'First Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
119
- 'class' => array( 'form-row-first' ),
120
- 'required' => true
121
- );
122
 
123
- // Billing Last Name.
124
- $new_fields['billing_last_name'] = array(
125
- 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
126
- 'placeholder' => _x( 'Last Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
127
- 'class' => array( 'form-row-last' ),
128
- 'clear' => true,
129
- 'required' => true
130
- );
131
 
132
  if ( 0 != $settings['person_type'] ) {
133
-
134
- // Billing Person Type.
135
  if ( 1 == $settings['person_type'] ) {
136
  $new_fields['billing_persontype'] = array(
137
  'type' => 'select',
@@ -148,7 +142,6 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
148
 
149
  if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
150
  if ( isset( $settings['rg'] ) ) {
151
- // Billing CPF.
152
  $new_fields['billing_cpf'] = array(
153
  'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
154
  'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -156,7 +149,6 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
156
  'required' => false
157
  );
158
 
159
- // Billing RG.
160
  $new_fields['billing_rg'] = array(
161
  'label' => __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ),
162
  'placeholder' => _x( 'RG', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -164,7 +156,6 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
164
  'required' => false
165
  );
166
  } else {
167
- // Billing CPF.
168
  $new_fields['billing_cpf'] = array(
169
  'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
170
  'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -175,17 +166,14 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
175
  }
176
 
177
  if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
178
- // Billing Company.
179
- $new_fields['billing_company'] = array(
180
- 'label' => __( 'Company Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
181
- 'placeholder' => _x( 'Company Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
182
- 'class' => array( 'form-row-wide', 'person-type-field' ),
183
- 'required' => false
184
- );
185
 
186
- // Billing State Registration.
187
  if ( isset( $settings['ie'] ) ) {
188
- // Billing CNPJ.
189
  $new_fields['billing_cnpj'] = array(
190
  'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
191
  'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -200,7 +188,6 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
200
  'required' => false
201
  );
202
  } else {
203
- // Billing CNPJ.
204
  $new_fields['billing_cnpj'] = array(
205
  'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
206
  'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -211,18 +198,14 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
211
  }
212
 
213
  } else {
214
- // Billing Company.
215
- $new_fields['billing_company'] = array(
216
- 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
217
- 'placeholder' => _x( 'Company', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
218
- 'class' => array( 'form-row-wide' ),
219
- 'required' => false
220
- );
221
  }
222
 
223
  if ( isset( $settings['birthdate_sex'] ) ) {
224
-
225
- // Billing Birthdate.
226
  $new_fields['billing_birthdate'] = array(
227
  'label' => __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' ),
228
  'placeholder' => _x( 'Birthdate', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -231,7 +214,6 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
231
  'required' => true
232
  );
233
 
234
- // Billing Sex.
235
  $new_fields['billing_sex'] = array(
236
  'type' => 'select',
237
  'label' => __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -244,37 +226,23 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
244
  __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' ) => __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' )
245
  )
246
  );
247
-
248
  }
249
 
250
- // Billing Country.
251
- $new_fields['billing_country'] = array(
252
- 'type' => 'country',
253
- 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
254
- 'placeholder' => _x( 'Country', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
255
- 'class' => array( 'form-row-first', 'update_totals_on_change', 'address-field' ),
256
- 'clear' => false,
257
- 'required' => true,
258
- );
259
 
260
- // Billing Post Code.
261
- $new_fields['billing_postcode'] = array(
262
- 'label' => __( 'Post Code', 'woocommerce-extra-checkout-fields-for-brazil' ),
263
- 'placeholder' => _x( 'Post Code', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
264
- 'class' => array( 'form-row-last', 'update_totals_on_change', 'address-field' ),
265
- 'clear' => true,
266
- 'required' => true
267
- );
268
 
269
- // Billing Anddress 01.
270
- $new_fields['billing_address_1'] = array(
271
- 'label' => __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ),
272
- 'placeholder' => _x( 'Address', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
273
- 'class' => array( 'form-row-first', 'address-field' ),
274
- 'required' => true
275
- );
276
 
277
- // Billing Number.
278
  $new_fields['billing_number'] = array(
279
  'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
280
  'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -283,12 +251,11 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
283
  'required' => true
284
  );
285
 
286
- // Billing Anddress 02.
287
- $new_fields['billing_address_2'] = array(
288
- 'label' => __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
289
- 'placeholder' => _x( 'Address line 2', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
290
- 'class' => array( 'form-row-first', 'address-field' )
291
- );
292
 
293
  // Billing Neighborhood.
294
  $new_fields['billing_neighborhood'] = array(
@@ -298,35 +265,25 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
298
  'clear' => true,
299
  );
300
 
301
- // Billing City.
302
- $new_fields['billing_city'] = array(
303
- 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
304
- 'placeholder' => _x( 'City', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
305
- 'class' => array( 'form-row-first', 'address-field' ),
306
- 'required' => true
307
- );
308
 
309
- // Billing State.
310
- $new_fields['billing_state'] = array(
311
- 'type' => 'state',
312
- 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
313
- 'placeholder' => _x( 'State', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
314
- 'class' => array( 'form-row-last', 'address-field' ),
315
- 'clear' => true,
316
- 'required' => true
317
- );
318
 
319
  if ( isset( $settings['cell_phone'] ) ) {
320
 
321
- // Billing Phone.
322
- $new_fields['billing_phone'] = array(
323
- 'label' => __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
324
- 'placeholder' => _x( 'Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
325
- 'class' => array( 'form-row-first' ),
326
- 'required' => true
327
- );
328
 
329
- // Billing Cell Phone.
330
  $new_fields['billing_cellphone'] = array(
331
  'label' => __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
332
  'placeholder' => _x( 'Cell Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -334,33 +291,24 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
334
  'clear' => true
335
  );
336
 
337
- // Billing Email.
338
- $new_fields['billing_email'] = array(
339
- 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
340
- 'placeholder' => _x( 'Email', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
341
- 'class' => array( 'form-row-wide' ),
342
- 'validate' => array( 'email' ),
343
- 'clear' => true,
344
- 'required' => true
345
- );
346
 
347
  } else {
 
 
 
 
 
348
 
349
- // Billing Phone.
350
- $new_fields['billing_phone'] = array(
351
- 'label' => __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
352
- 'placeholder' => _x( 'Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
353
- 'class' => array( 'form-row-wide' ),
354
- 'required' => true
355
- );
356
-
357
- // Billing Email.
358
- $new_fields['billing_email'] = array(
359
- 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
360
- 'placeholder' => _x( 'Email', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
361
- 'class' => array( 'form-row-wide' ),
362
- 'required' => true
363
- );
364
 
365
  }
366
 
@@ -375,63 +323,39 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
375
  * @return array New fields.
376
  */
377
  public function checkout_shipping_fields( $fields ) {
378
-
379
  $new_fields = array();
380
 
381
- // Get plugin settings.
382
- $settings = get_option( 'wcbcf_settings' );
383
-
384
- // Shipping First Name.
385
- $new_fields['shipping_first_name'] = array(
386
- 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
387
- 'placeholder' => _x( 'First Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
388
- 'class' => array( 'form-row-first' ),
389
- 'required' => true
390
- );
391
 
392
- // Shipping Last Name.
393
- $new_fields['shipping_last_name'] = array(
394
- 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
395
- 'placeholder' => _x( 'Last Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
396
- 'class' => array( 'form-row-last' ),
397
- 'clear' => true,
398
- 'required' => true
399
- );
400
 
401
- // Shipping Company.
402
- $new_fields['shipping_company'] = array(
403
- 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
404
- 'placeholder' => _x( 'Company', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
405
- 'class' => array( 'form-row-wide' )
406
- );
407
 
408
- // Shipping Country.
409
- $new_fields['shipping_country'] = array(
410
- 'type' => 'country',
411
- 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
412
- 'placeholder' => _x( 'Country', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
413
- 'class' => array( 'form-row-first', 'update_totals_on_change', 'address-field' ),
414
- 'required' => true
415
- );
416
 
417
- // Shipping Post Code.
418
- $new_fields['shipping_postcode'] = array(
419
- 'label' => __( 'Post Code', 'woocommerce-extra-checkout-fields-for-brazil' ),
420
- 'placeholder' => _x( 'Post Code', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
421
- 'class' => array( 'form-row-last', 'update_totals_on_change', 'address-field' ),
422
- 'clear' => true,
423
- 'required' => true
424
- );
425
 
426
- // Shipping Anddress 01.
427
- $new_fields['shipping_address_1'] = array(
428
- 'label' => __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ),
429
- 'placeholder' => _x( 'Address', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
430
- 'class' => array( 'form-row-first', 'address-field' ),
431
- 'required' => true
432
- );
433
 
434
- // Shipping Number.
435
  $new_fields['shipping_number'] = array(
436
  'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
437
  'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
@@ -440,38 +364,30 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
440
  'required' => true
441
  );
442
 
443
- // Shipping Anddress 02.
444
- $new_fields['shipping_address_2'] = array(
445
- 'label' => __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
446
- 'placeholder' => _x( 'Address line 2', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
447
- 'class' => array( 'form-row-first', 'address-field' )
448
- );
449
 
450
- // Shipping Neighborhood.
451
  $new_fields['shipping_neighborhood'] = array(
452
  'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
453
  'placeholder' => _x( 'Neighborhood', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
454
  'class' => array( 'form-row-last', 'address-field' ),
455
- 'clear' => true
456
  );
457
 
458
- // Shipping City.
459
- $new_fields['shipping_city'] = array(
460
- 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
461
- 'placeholder' => _x( 'City', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
462
- 'class' => array( 'form-row-first', 'address-field' ),
463
- 'required' => true
464
- );
465
 
466
- // Shipping State.
467
- $new_fields['shipping_state'] = array(
468
- 'type' => 'state',
469
- 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
470
- 'placeholder' => _x( 'State', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
471
- 'class' => array( 'form-row-last', 'address-field' ),
472
- 'clear' => true,
473
- 'required' => true
474
- );
475
 
476
  return apply_filters( 'wcbcf_shipping_fields', $new_fields );
477
  }
@@ -621,10 +537,10 @@ class Extra_Checkout_Fields_For_Brazil_Front_End {
621
  */
622
  public function order_address( $address, $type, $order ) {
623
  $number = $type . '_number';
624
- $neighborhood = $type . 'neighborhood';
625
 
626
- $address['number'] = $this->$number;
627
- $address['neighborhood'] = $this->$neighborhood;
628
 
629
  return $address;
630
  }
15
  // Load custom order data.
16
  add_filter( 'woocommerce_load_order_data', array( $this, 'load_order_data' ) );
17
 
18
+ // Load public-facing scripts.
19
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
20
+ add_action( 'woocommerce_after_edit_account_address_form', array( $this, 'load_scripts' ) );
21
+ add_action( 'woocommerce_after_checkout_form', array( $this, 'load_scripts' ) );
22
 
23
  // New checkout fields.
24
+ add_filter( 'woocommerce_billing_fields', array( $this, 'checkout_billing_fields' ), 10 );
25
+ add_filter( 'woocommerce_shipping_fields', array( $this, 'checkout_shipping_fields' ), 10 );
26
 
27
  // Valid checkout fields.
28
  add_action( 'woocommerce_checkout_process', array( $this, 'valid_checkout_fields' ) );
67
  }
68
 
69
  /**
70
+ * Register scripts.
71
  */
72
  public function enqueue_scripts() {
73
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
76
 
77
  wp_register_script( 'mailcheck', plugins_url( 'assets/js/mailcheck/mailcheck' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), '1.1.1', true );
78
 
79
+ wp_register_script( 'woocommerce-extra-checkout-fields-for-brazil-front', plugins_url( 'assets/js/frontend/frontend' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'jquery-maskedinput', 'mailcheck' ), Extra_Checkout_Fields_For_Brazil::VERSION, true );
80
+ }
81
+
82
+ /**
83
+ * Load scripts.
84
+ */
85
+ public function load_scripts() {
86
+ $settings = get_option( 'wcbcf_settings' );
87
+ $autofill = isset( $settings['addresscomplete'] ) ? 'yes' : 'no';
88
+
89
+ wp_enqueue_script( 'woocommerce-extra-checkout-fields-for-brazil-front' );
90
+ wp_localize_script(
91
+ 'woocommerce-extra-checkout-fields-for-brazil-front',
92
+ 'wcbcf_public_params',
93
+ array(
94
+ 'state' => esc_js( __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
95
+ 'required' => esc_js( __( 'required', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
96
+ 'mailcheck' => isset( $settings['mailcheck'] ) ? 'yes' : 'no',
97
+ 'maskedinput' => isset( $settings['maskedinput'] ) ? 'yes' : 'no',
98
+ 'addresscomplete' => apply_filters( 'woocommerce_correios_enable_autofill_addresses', false ) ? false : $autofill,
99
+ 'person_type' => absint( $settings['person_type'] ),
100
+ 'only_brazil' => isset( $settings['only_brazil'] ) ? 'yes' : 'no'
101
+ )
102
+ );
103
  }
104
 
105
  /**
110
  * @return array New fields.
111
  */
112
  public function checkout_billing_fields( $fields ) {
 
113
  $new_fields = array();
114
 
115
  // Get plugin settings.
116
  $settings = get_option( 'wcbcf_settings' );
117
 
118
+ if ( isset( $fields['billing_first_name'] ) ) {
119
+ $new_fields['billing_first_name'] = $fields['billing_first_name'];
120
+ $new_fields['billing_first_name']['class'] = array( 'form-row-first' );
121
+ }
 
 
 
122
 
123
+ if ( isset( $fields['billing_last_name'] ) ) {
124
+ $new_fields['billing_last_name'] = $fields['billing_last_name'];
125
+ $new_fields['billing_last_name']['class'] = array( 'form-row-last' );
126
+ }
 
 
 
 
127
 
128
  if ( 0 != $settings['person_type'] ) {
 
 
129
  if ( 1 == $settings['person_type'] ) {
130
  $new_fields['billing_persontype'] = array(
131
  'type' => 'select',
142
 
143
  if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
144
  if ( isset( $settings['rg'] ) ) {
 
145
  $new_fields['billing_cpf'] = array(
146
  'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
147
  'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
149
  'required' => false
150
  );
151
 
 
152
  $new_fields['billing_rg'] = array(
153
  'label' => __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ),
154
  'placeholder' => _x( 'RG', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
156
  'required' => false
157
  );
158
  } else {
 
159
  $new_fields['billing_cpf'] = array(
160
  'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
161
  'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
166
  }
167
 
168
  if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
169
+ if ( isset( $fields['billing_company'] ) ) {
170
+ $new_fields['billing_company'] = $fields['billing_company'];
171
+ $new_fields['billing_company']['class'] = array( 'form-row-wide' );
172
+ $new_fields['billing_company']['clear'] = true;
173
+ $new_fields['billing_company']['required'] = false;
174
+ }
 
175
 
 
176
  if ( isset( $settings['ie'] ) ) {
 
177
  $new_fields['billing_cnpj'] = array(
178
  'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
179
  'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
188
  'required' => false
189
  );
190
  } else {
 
191
  $new_fields['billing_cnpj'] = array(
192
  'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
193
  'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
198
  }
199
 
200
  } else {
201
+ if ( isset( $fields['billing_company'] ) ) {
202
+ $new_fields['billing_company'] = $fields['billing_company'];
203
+ $new_fields['billing_company']['class'] = array( 'form-row-wide' );
204
+ $new_fields['billing_company']['clear'] = true;
205
+ }
 
 
206
  }
207
 
208
  if ( isset( $settings['birthdate_sex'] ) ) {
 
 
209
  $new_fields['billing_birthdate'] = array(
210
  'label' => __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' ),
211
  'placeholder' => _x( 'Birthdate', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
214
  'required' => true
215
  );
216
 
 
217
  $new_fields['billing_sex'] = array(
218
  'type' => 'select',
219
  'label' => __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' ),
226
  __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' ) => __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' )
227
  )
228
  );
 
229
  }
230
 
231
+ if ( isset( $fields['billing_country'] ) ) {
232
+ $new_fields['billing_country'] = $fields['billing_country'];
233
+ $new_fields['billing_country']['class'] = array( 'form-row-first', 'address-field', 'update_totals_on_change' );
234
+ }
 
 
 
 
 
235
 
236
+ if ( isset( $fields['billing_postcode'] ) ) {
237
+ $new_fields['billing_postcode'] = $fields['billing_postcode'];
238
+ $new_fields['billing_postcode']['class'] = array( 'form-row-last', 'address-field' );
239
+ }
 
 
 
 
240
 
241
+ if ( isset( $fields['billing_address_1'] ) ) {
242
+ $new_fields['billing_address_1'] = $fields['billing_address_1'];
243
+ $new_fields['billing_address_1']['class'] = array( 'form-row-first', 'address-field' );
244
+ }
 
 
 
245
 
 
246
  $new_fields['billing_number'] = array(
247
  'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
248
  'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
251
  'required' => true
252
  );
253
 
254
+ if ( isset( $fields['billing_address_2'] ) ) {
255
+ $new_fields['billing_address_2'] = $fields['billing_address_2'];
256
+ $new_fields['billing_address_2']['label'] = __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' );
257
+ $new_fields['billing_address_2']['class'] = array( 'form-row-first', 'address-field' );
258
+ }
 
259
 
260
  // Billing Neighborhood.
261
  $new_fields['billing_neighborhood'] = array(
265
  'clear' => true,
266
  );
267
 
268
+ if ( isset( $fields['billing_city'] ) ) {
269
+ $new_fields['billing_city'] = $fields['billing_city'];
270
+ $new_fields['billing_city']['class'] = array( 'form-row-first', 'address-field' );
271
+ }
 
 
 
272
 
273
+ if ( isset( $fields['billing_state'] ) ) {
274
+ $new_fields['billing_state'] = $fields['billing_state'];
275
+ $new_fields['billing_state']['class'] = array( 'form-row-last', 'address-field' );
276
+ $new_fields['billing_state']['clear'] = true;
277
+ }
 
 
 
 
278
 
279
  if ( isset( $settings['cell_phone'] ) ) {
280
 
281
+ if ( isset( $fields['billing_phone'] ) ) {
282
+ $new_fields['billing_phone'] = $fields['billing_phone'];
283
+ $new_fields['billing_phone']['class'] = array( 'form-row-first' );
284
+ $new_fields['billing_phone']['clear'] = false;
285
+ }
 
 
286
 
 
287
  $new_fields['billing_cellphone'] = array(
288
  'label' => __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
289
  'placeholder' => _x( 'Cell Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
291
  'clear' => true
292
  );
293
 
294
+ if ( isset( $fields['billing_email'] ) ) {
295
+ $new_fields['billing_email'] = $fields['billing_email'];
296
+ $new_fields['billing_email']['class'] = array( 'form-row-wide' );
297
+ $new_fields['billing_email']['clear'] = true;
298
+ }
 
 
 
 
299
 
300
  } else {
301
+ if ( isset( $fields['billing_phone'] ) ) {
302
+ $new_fields['billing_phone'] = $fields['billing_phone'];
303
+ $new_fields['billing_state']['class'] = array( 'form-row-wide' );
304
+ $new_fields['billing_state']['clear'] = true;
305
+ }
306
 
307
+ if ( isset( $fields['billing_email'] ) ) {
308
+ $new_fields['billing_email'] = $fields['billing_email'];
309
+ $new_fields['billing_email']['class'] = array( 'form-row-wide' );
310
+ $new_fields['billing_email']['clear'] = true;
311
+ }
 
 
 
 
 
 
 
 
 
 
312
 
313
  }
314
 
323
  * @return array New fields.
324
  */
325
  public function checkout_shipping_fields( $fields ) {
 
326
  $new_fields = array();
327
 
328
+ if ( isset( $fields['shipping_first_name'] ) ) {
329
+ $new_fields['shipping_first_name'] = $fields['shipping_first_name'];
330
+ $new_fields['shipping_first_name']['class'] = array( 'form-row-first' );
331
+ }
 
 
 
 
 
 
332
 
333
+ if ( isset( $fields['shipping_last_name'] ) ) {
334
+ $new_fields['shipping_last_name'] = $fields['shipping_last_name'];
335
+ $new_fields['shipping_last_name']['class'] = array( 'form-row-last' );
336
+ }
 
 
 
 
337
 
338
+ if ( isset( $fields['shipping_company'] ) ) {
339
+ $new_fields['shipping_company'] = $fields['shipping_company'];
340
+ $new_fields['shipping_company']['class'] = array( 'form-row-wide' );
341
+ $new_fields['shipping_company']['clear'] = true;
342
+ }
 
343
 
344
+ if ( isset( $fields['shipping_country'] ) ) {
345
+ $new_fields['shipping_country'] = $fields['shipping_country'];
346
+ $new_fields['shipping_country']['class'] = array( 'form-row-first', 'address-field', 'update_totals_on_change' );
347
+ }
 
 
 
 
348
 
349
+ if ( isset( $fields['shipping_postcode'] ) ) {
350
+ $new_fields['shipping_postcode'] = $fields['shipping_postcode'];
351
+ $new_fields['shipping_postcode']['class'] = array( 'form-row-last', 'address-field' );
352
+ }
 
 
 
 
353
 
354
+ if ( isset( $fields['shipping_address_1'] ) ) {
355
+ $new_fields['shipping_address_1'] = $fields['shipping_address_1'];
356
+ $new_fields['shipping_address_1']['class'] = array( 'form-row-first', 'address-field' );
357
+ }
 
 
 
358
 
 
359
  $new_fields['shipping_number'] = array(
360
  'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
361
  'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
364
  'required' => true
365
  );
366
 
367
+ if ( isset( $fields['shipping_address_2'] ) ) {
368
+ $new_fields['shipping_address_2'] = $fields['shipping_address_2'];
369
+ $new_fields['shipping_address_2']['label'] = __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' );
370
+ $new_fields['shipping_address_2']['class'] = array( 'form-row-first', 'address-field' );
371
+ }
 
372
 
373
+ // Billing Neighborhood.
374
  $new_fields['shipping_neighborhood'] = array(
375
  'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
376
  'placeholder' => _x( 'Neighborhood', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
377
  'class' => array( 'form-row-last', 'address-field' ),
378
+ 'clear' => true,
379
  );
380
 
381
+ if ( isset( $fields['shipping_city'] ) ) {
382
+ $new_fields['shipping_city'] = $fields['shipping_city'];
383
+ $new_fields['shipping_city']['class'] = array( 'form-row-first', 'address-field' );
384
+ }
 
 
 
385
 
386
+ if ( isset( $fields['shipping_state'] ) ) {
387
+ $new_fields['shipping_state'] = $fields['shipping_state'];
388
+ $new_fields['shipping_state']['class'] = array( 'form-row-last', 'address-field' );
389
+ $new_fields['shipping_state']['clear'] = true;
390
+ }
 
 
 
 
391
 
392
  return apply_filters( 'wcbcf_shipping_fields', $new_fields );
393
  }
537
  */
538
  public function order_address( $address, $type, $order ) {
539
  $number = $type . '_number';
540
+ $neighborhood = $type . '_neighborhood';
541
 
542
+ $address['number'] = $order->$number;
543
+ $address['neighborhood'] = $order->$neighborhood;
544
 
545
  return $address;
546
  }
languages/woocommerce-extra-checkout-fields-for-brazil.pot CHANGED
@@ -2,11 +2,11 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Extra Checkout Fields for Brazil 3.4.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-extra-checkout-fields-for-"
8
  "brazil\n"
9
- "POT-Creation-Date: 2016-03-21 02:56:41+00:00\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=utf-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
@@ -30,50 +30,50 @@ msgstr ""
30
  #: includes/admin/class-wc-ecfb-customer.php:40
31
  #: includes/admin/class-wc-ecfb-order.php:58
32
  #: includes/admin/class-wc-ecfb-order.php:266
33
- #: includes/class-wc-ecfb-front-end.php:153
34
- #: includes/class-wc-ecfb-front-end.php:169
35
- #: includes/class-wc-ecfb-front-end.php:505
36
- #: includes/class-wc-ecfb-front-end.php:509
37
  msgid "CPF"
38
  msgstr ""
39
 
40
  #: includes/admin/class-wc-ecfb-customer.php:46
41
  #: includes/admin/class-wc-ecfb-order.php:62
42
  #: includes/admin/class-wc-ecfb-order.php:269
43
- #: includes/class-wc-ecfb-front-end.php:161
44
- #: includes/class-wc-ecfb-front-end.php:513
45
  msgid "RG"
46
  msgstr ""
47
 
48
  #: includes/admin/class-wc-ecfb-customer.php:55
49
  #: includes/admin/class-wc-ecfb-order.php:72
50
  #: includes/admin/class-wc-ecfb-order.php:275
51
- #: includes/class-wc-ecfb-front-end.php:190
52
- #: includes/class-wc-ecfb-front-end.php:205
53
- #: includes/class-wc-ecfb-front-end.php:524
54
- #: includes/class-wc-ecfb-front-end.php:528
55
  msgid "CNPJ"
56
  msgstr ""
57
 
58
  #: includes/admin/class-wc-ecfb-customer.php:61
59
  #: includes/admin/class-wc-ecfb-order.php:76
60
  #: includes/admin/class-wc-ecfb-order.php:278
61
- #: includes/class-wc-ecfb-front-end.php:197
62
- #: includes/class-wc-ecfb-front-end.php:532
63
  msgid "State Registration"
64
  msgstr ""
65
 
66
  #: includes/admin/class-wc-ecfb-customer.php:72
67
  #: includes/admin/class-wc-ecfb-order.php:90
68
  #: includes/admin/class-wc-ecfb-order.php:288
69
- #: includes/class-wc-ecfb-front-end.php:227
70
  msgid "Birthdate"
71
  msgstr ""
72
 
73
  #: includes/admin/class-wc-ecfb-customer.php:76
74
  #: includes/admin/class-wc-ecfb-order.php:93
75
  #: includes/admin/class-wc-ecfb-order.php:291
76
- #: includes/class-wc-ecfb-front-end.php:237
77
  msgid "Sex"
78
  msgstr ""
79
 
@@ -81,8 +81,8 @@ msgstr ""
81
  #: includes/admin/class-wc-ecfb-customer.php:113
82
  #: includes/admin/class-wc-ecfb-order.php:102
83
  #: includes/admin/class-wc-ecfb-order.php:177
84
- #: includes/class-wc-ecfb-front-end.php:279
85
- #: includes/class-wc-ecfb-front-end.php:436
86
  msgid "Number"
87
  msgstr ""
88
 
@@ -90,15 +90,15 @@ msgstr ""
90
  #: includes/admin/class-wc-ecfb-customer.php:118
91
  #: includes/admin/class-wc-ecfb-order.php:110
92
  #: includes/admin/class-wc-ecfb-order.php:185
93
- #: includes/class-wc-ecfb-front-end.php:295
94
- #: includes/class-wc-ecfb-front-end.php:452
95
  msgid "Neighborhood"
96
  msgstr ""
97
 
98
  #: includes/admin/class-wc-ecfb-customer.php:99
99
  #: includes/admin/class-wc-ecfb-order.php:140
100
  #: includes/admin/class-wc-ecfb-order.php:298
101
- #: includes/class-wc-ecfb-front-end.php:331
102
  msgid "Cell Phone"
103
  msgstr ""
104
 
@@ -108,52 +108,45 @@ msgstr ""
108
 
109
  #: includes/admin/class-wc-ecfb-order.php:35
110
  #: includes/admin/class-wc-ecfb-order.php:161
111
- #: includes/class-wc-ecfb-front-end.php:117
112
- #: includes/class-wc-ecfb-front-end.php:386
113
  msgid "First Name"
114
  msgstr ""
115
 
116
  #: includes/admin/class-wc-ecfb-order.php:39
117
  #: includes/admin/class-wc-ecfb-order.php:165
118
- #: includes/class-wc-ecfb-front-end.php:125
119
- #: includes/class-wc-ecfb-front-end.php:394
120
  msgid "Last Name"
121
  msgstr ""
122
 
123
  #: includes/admin/class-wc-ecfb-order.php:47
124
- #: includes/class-wc-ecfb-front-end.php:138
125
- #: includes/class-wc-ecfb-front-end.php:499
126
  msgid "Person type"
127
  msgstr ""
128
 
129
  #: includes/admin/class-wc-ecfb-order.php:49
130
- #: includes/class-wc-ecfb-front-end.php:142
131
- #: includes/class-wc-ecfb-front-end.php:242
132
  msgid "Select"
133
  msgstr ""
134
 
135
  #: includes/admin/class-wc-ecfb-order.php:50
136
- #: includes/class-wc-ecfb-front-end.php:143
137
  msgid "Individuals"
138
  msgstr ""
139
 
140
  #: includes/admin/class-wc-ecfb-order.php:51
141
- #: includes/class-wc-ecfb-front-end.php:144
142
  msgid "Legal Person"
143
  msgstr ""
144
 
145
  #: includes/admin/class-wc-ecfb-order.php:69
146
  #: includes/admin/class-wc-ecfb-order.php:274
147
- #: includes/class-wc-ecfb-front-end.php:180
148
  msgid "Company Name"
149
  msgstr ""
150
 
151
  #: includes/admin/class-wc-ecfb-order.php:83
152
  #: includes/admin/class-wc-ecfb-order.php:169
153
  #: includes/admin/class-wc-ecfb-order.php:282
154
- #: includes/class-wc-ecfb-front-end.php:216
155
- #: includes/class-wc-ecfb-front-end.php:403
156
- #: includes/class-wc-ecfb-front-end.php:520
157
  msgid "Company"
158
  msgstr ""
159
 
@@ -169,23 +162,17 @@ msgstr ""
169
 
170
  #: includes/admin/class-wc-ecfb-order.php:114
171
  #: includes/admin/class-wc-ecfb-order.php:189
172
- #: includes/class-wc-ecfb-front-end.php:303
173
- #: includes/class-wc-ecfb-front-end.php:460
174
  msgid "City"
175
  msgstr ""
176
 
177
  #: includes/admin/class-wc-ecfb-order.php:118
178
  #: includes/admin/class-wc-ecfb-order.php:193
179
- #: includes/class-wc-ecfb-front-end.php:89
180
- #: includes/class-wc-ecfb-front-end.php:312
181
- #: includes/class-wc-ecfb-front-end.php:469
182
  msgid "State"
183
  msgstr ""
184
 
185
  #: includes/admin/class-wc-ecfb-order.php:122
186
  #: includes/admin/class-wc-ecfb-order.php:197
187
- #: includes/class-wc-ecfb-front-end.php:253
188
- #: includes/class-wc-ecfb-front-end.php:411
189
  msgid "Country"
190
  msgstr ""
191
 
@@ -201,15 +188,11 @@ msgstr ""
201
 
202
  #: includes/admin/class-wc-ecfb-order.php:135
203
  #: includes/admin/class-wc-ecfb-order.php:294
204
- #: includes/class-wc-ecfb-front-end.php:323
205
- #: includes/class-wc-ecfb-front-end.php:351
206
  msgid "Phone"
207
  msgstr ""
208
 
209
  #: includes/admin/class-wc-ecfb-order.php:145
210
  #: includes/admin/class-wc-ecfb-order.php:301
211
- #: includes/class-wc-ecfb-front-end.php:339
212
- #: includes/class-wc-ecfb-front-end.php:359
213
  msgid "Email"
214
  msgstr ""
215
 
@@ -217,8 +200,6 @@ msgstr ""
217
  #: includes/admin/class-wc-ecfb-order.php:253
218
  #: includes/admin/class-wc-ecfb-order.php:327
219
  #: includes/admin/class-wc-ecfb-order.php:330
220
- #: includes/class-wc-ecfb-front-end.php:271
221
- #: includes/class-wc-ecfb-front-end.php:428
222
  msgid "Address"
223
  msgstr ""
224
 
@@ -335,75 +316,110 @@ msgid ""
335
  "and Cell Phone."
336
  msgstr ""
337
 
338
- #: includes/admin/class-wc-ecfb-settings.php:183
339
  msgid "Enable Address Autocomplete:"
340
  msgstr ""
341
 
342
- #: includes/admin/class-wc-ecfb-settings.php:190
343
  msgid "If checked automatically complete the address fields based on the zip code."
344
  msgstr ""
345
 
346
- #: includes/admin/class-wc-ecfb-settings.php:197
347
  msgid "Validation:"
348
  msgstr ""
349
 
350
- #: includes/admin/class-wc-ecfb-settings.php:205
351
  msgid "Validate CPF:"
352
  msgstr ""
353
 
354
- #: includes/admin/class-wc-ecfb-settings.php:212
355
  msgid "Checks if the CPF is valid."
356
  msgstr ""
357
 
358
- #: includes/admin/class-wc-ecfb-settings.php:219
359
  msgid "Validate CNPJ:"
360
  msgstr ""
361
 
362
- #: includes/admin/class-wc-ecfb-settings.php:226
363
  msgid "Checks if the CNPJ is valid."
364
  msgstr ""
365
 
366
- #: includes/class-wc-ecfb-front-end.php:90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  msgid "required"
368
  msgstr ""
369
 
370
- #: includes/class-wc-ecfb-front-end.php:243
371
  msgid "Female"
372
  msgstr ""
373
 
374
- #: includes/class-wc-ecfb-front-end.php:244
375
  msgid "Male"
376
  msgstr ""
377
 
378
- #: includes/class-wc-ecfb-front-end.php:262
379
- #: includes/class-wc-ecfb-front-end.php:419
380
- msgid "Post Code"
381
- msgstr ""
382
-
383
- #: includes/class-wc-ecfb-front-end.php:288
384
- #: includes/class-wc-ecfb-front-end.php:445
385
  msgid "Address line 2"
386
  msgstr ""
387
 
388
- #: includes/class-wc-ecfb-front-end.php:499
389
- #: includes/class-wc-ecfb-front-end.php:505
390
- #: includes/class-wc-ecfb-front-end.php:513
391
- #: includes/class-wc-ecfb-front-end.php:520
392
- #: includes/class-wc-ecfb-front-end.php:524
393
- #: includes/class-wc-ecfb-front-end.php:532
394
  msgid "is a required field"
395
  msgstr ""
396
 
397
- #: includes/class-wc-ecfb-front-end.php:509
398
- #: includes/class-wc-ecfb-front-end.php:528
399
  msgid "is not valid"
400
  msgstr ""
401
 
402
- #: woocommerce-extra-checkout-fields-for-brazil.php:119
403
  msgid "WooCommerce Extra Checkout Fields for Brazil depends on %s to work!"
404
  msgstr ""
405
 
406
- #: woocommerce-extra-checkout-fields-for-brazil.php:119
407
  msgid "WooCommerce"
408
  msgstr ""
409
 
@@ -430,117 +446,46 @@ msgstr ""
430
  msgid "http://claudiosmweb.com/"
431
  msgstr ""
432
 
433
- #: includes/class-wc-ecfb-front-end.php:118
434
- #: includes/class-wc-ecfb-front-end.php:387
435
- msgctxt "placeholder"
436
- msgid "First Name"
437
- msgstr ""
438
-
439
- #: includes/class-wc-ecfb-front-end.php:126
440
- #: includes/class-wc-ecfb-front-end.php:395
441
- msgctxt "placeholder"
442
- msgid "Last Name"
443
- msgstr ""
444
-
445
- #: includes/class-wc-ecfb-front-end.php:154
446
- #: includes/class-wc-ecfb-front-end.php:170
447
  msgctxt "placeholder"
448
  msgid "CPF"
449
  msgstr ""
450
 
451
- #: includes/class-wc-ecfb-front-end.php:162
452
  msgctxt "placeholder"
453
  msgid "RG"
454
  msgstr ""
455
 
456
- #: includes/class-wc-ecfb-front-end.php:181
457
- msgctxt "placeholder"
458
- msgid "Company Name"
459
- msgstr ""
460
-
461
- #: includes/class-wc-ecfb-front-end.php:191
462
- #: includes/class-wc-ecfb-front-end.php:206
463
  msgctxt "placeholder"
464
  msgid "CNPJ"
465
  msgstr ""
466
 
467
- #: includes/class-wc-ecfb-front-end.php:198
468
  msgctxt "placeholder"
469
  msgid "State Registration"
470
  msgstr ""
471
 
472
- #: includes/class-wc-ecfb-front-end.php:217
473
- #: includes/class-wc-ecfb-front-end.php:404
474
- msgctxt "placeholder"
475
- msgid "Company"
476
- msgstr ""
477
-
478
- #: includes/class-wc-ecfb-front-end.php:228
479
  msgctxt "placeholder"
480
  msgid "Birthdate"
481
  msgstr ""
482
 
483
- #: includes/class-wc-ecfb-front-end.php:254
484
- #: includes/class-wc-ecfb-front-end.php:412
485
- msgctxt "placeholder"
486
- msgid "Country"
487
- msgstr ""
488
-
489
- #: includes/class-wc-ecfb-front-end.php:263
490
- #: includes/class-wc-ecfb-front-end.php:420
491
- msgctxt "placeholder"
492
- msgid "Post Code"
493
- msgstr ""
494
-
495
- #: includes/class-wc-ecfb-front-end.php:272
496
- #: includes/class-wc-ecfb-front-end.php:429
497
- msgctxt "placeholder"
498
- msgid "Address"
499
- msgstr ""
500
-
501
- #: includes/class-wc-ecfb-front-end.php:280
502
- #: includes/class-wc-ecfb-front-end.php:437
503
  msgctxt "placeholder"
504
  msgid "Number"
505
  msgstr ""
506
 
507
- #: includes/class-wc-ecfb-front-end.php:289
508
- #: includes/class-wc-ecfb-front-end.php:446
509
- msgctxt "placeholder"
510
- msgid "Address line 2"
511
- msgstr ""
512
-
513
- #: includes/class-wc-ecfb-front-end.php:296
514
- #: includes/class-wc-ecfb-front-end.php:453
515
  msgctxt "placeholder"
516
  msgid "Neighborhood"
517
  msgstr ""
518
 
519
- #: includes/class-wc-ecfb-front-end.php:304
520
- #: includes/class-wc-ecfb-front-end.php:461
521
- msgctxt "placeholder"
522
- msgid "City"
523
- msgstr ""
524
-
525
- #: includes/class-wc-ecfb-front-end.php:313
526
- #: includes/class-wc-ecfb-front-end.php:470
527
- msgctxt "placeholder"
528
- msgid "State"
529
- msgstr ""
530
-
531
- #: includes/class-wc-ecfb-front-end.php:324
532
- #: includes/class-wc-ecfb-front-end.php:352
533
- msgctxt "placeholder"
534
- msgid "Phone"
535
- msgstr ""
536
-
537
- #: includes/class-wc-ecfb-front-end.php:332
538
  msgctxt "placeholder"
539
  msgid "Cell Phone"
540
- msgstr ""
541
-
542
- #: includes/class-wc-ecfb-front-end.php:340
543
- #: includes/class-wc-ecfb-front-end.php:360
544
- msgctxt "placeholder"
545
- msgid "Email"
546
  msgstr ""
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Extra Checkout Fields for Brazil 3.4.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-extra-checkout-fields-for-"
8
  "brazil\n"
9
+ "POT-Creation-Date: 2016-06-20 05:08:04+00:00\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=utf-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
30
  #: includes/admin/class-wc-ecfb-customer.php:40
31
  #: includes/admin/class-wc-ecfb-order.php:58
32
  #: includes/admin/class-wc-ecfb-order.php:266
33
+ #: includes/class-wc-ecfb-front-end.php:146
34
+ #: includes/class-wc-ecfb-front-end.php:160
35
+ #: includes/class-wc-ecfb-front-end.php:421
36
+ #: includes/class-wc-ecfb-front-end.php:425
37
  msgid "CPF"
38
  msgstr ""
39
 
40
  #: includes/admin/class-wc-ecfb-customer.php:46
41
  #: includes/admin/class-wc-ecfb-order.php:62
42
  #: includes/admin/class-wc-ecfb-order.php:269
43
+ #: includes/class-wc-ecfb-front-end.php:153
44
+ #: includes/class-wc-ecfb-front-end.php:429
45
  msgid "RG"
46
  msgstr ""
47
 
48
  #: includes/admin/class-wc-ecfb-customer.php:55
49
  #: includes/admin/class-wc-ecfb-order.php:72
50
  #: includes/admin/class-wc-ecfb-order.php:275
51
+ #: includes/class-wc-ecfb-front-end.php:178
52
+ #: includes/class-wc-ecfb-front-end.php:192
53
+ #: includes/class-wc-ecfb-front-end.php:440
54
+ #: includes/class-wc-ecfb-front-end.php:444
55
  msgid "CNPJ"
56
  msgstr ""
57
 
58
  #: includes/admin/class-wc-ecfb-customer.php:61
59
  #: includes/admin/class-wc-ecfb-order.php:76
60
  #: includes/admin/class-wc-ecfb-order.php:278
61
+ #: includes/class-wc-ecfb-front-end.php:185
62
+ #: includes/class-wc-ecfb-front-end.php:448
63
  msgid "State Registration"
64
  msgstr ""
65
 
66
  #: includes/admin/class-wc-ecfb-customer.php:72
67
  #: includes/admin/class-wc-ecfb-order.php:90
68
  #: includes/admin/class-wc-ecfb-order.php:288
69
+ #: includes/class-wc-ecfb-front-end.php:210
70
  msgid "Birthdate"
71
  msgstr ""
72
 
73
  #: includes/admin/class-wc-ecfb-customer.php:76
74
  #: includes/admin/class-wc-ecfb-order.php:93
75
  #: includes/admin/class-wc-ecfb-order.php:291
76
+ #: includes/class-wc-ecfb-front-end.php:219
77
  msgid "Sex"
78
  msgstr ""
79
 
81
  #: includes/admin/class-wc-ecfb-customer.php:113
82
  #: includes/admin/class-wc-ecfb-order.php:102
83
  #: includes/admin/class-wc-ecfb-order.php:177
84
+ #: includes/class-wc-ecfb-front-end.php:247
85
+ #: includes/class-wc-ecfb-front-end.php:360
86
  msgid "Number"
87
  msgstr ""
88
 
90
  #: includes/admin/class-wc-ecfb-customer.php:118
91
  #: includes/admin/class-wc-ecfb-order.php:110
92
  #: includes/admin/class-wc-ecfb-order.php:185
93
+ #: includes/class-wc-ecfb-front-end.php:262
94
+ #: includes/class-wc-ecfb-front-end.php:375
95
  msgid "Neighborhood"
96
  msgstr ""
97
 
98
  #: includes/admin/class-wc-ecfb-customer.php:99
99
  #: includes/admin/class-wc-ecfb-order.php:140
100
  #: includes/admin/class-wc-ecfb-order.php:298
101
+ #: includes/class-wc-ecfb-front-end.php:288
102
  msgid "Cell Phone"
103
  msgstr ""
104
 
108
 
109
  #: includes/admin/class-wc-ecfb-order.php:35
110
  #: includes/admin/class-wc-ecfb-order.php:161
 
 
111
  msgid "First Name"
112
  msgstr ""
113
 
114
  #: includes/admin/class-wc-ecfb-order.php:39
115
  #: includes/admin/class-wc-ecfb-order.php:165
 
 
116
  msgid "Last Name"
117
  msgstr ""
118
 
119
  #: includes/admin/class-wc-ecfb-order.php:47
120
+ #: includes/class-wc-ecfb-front-end.php:132
121
+ #: includes/class-wc-ecfb-front-end.php:415
122
  msgid "Person type"
123
  msgstr ""
124
 
125
  #: includes/admin/class-wc-ecfb-order.php:49
126
+ #: includes/class-wc-ecfb-front-end.php:136
127
+ #: includes/class-wc-ecfb-front-end.php:224
128
  msgid "Select"
129
  msgstr ""
130
 
131
  #: includes/admin/class-wc-ecfb-order.php:50
132
+ #: includes/class-wc-ecfb-front-end.php:137
133
  msgid "Individuals"
134
  msgstr ""
135
 
136
  #: includes/admin/class-wc-ecfb-order.php:51
137
+ #: includes/class-wc-ecfb-front-end.php:138
138
  msgid "Legal Person"
139
  msgstr ""
140
 
141
  #: includes/admin/class-wc-ecfb-order.php:69
142
  #: includes/admin/class-wc-ecfb-order.php:274
 
143
  msgid "Company Name"
144
  msgstr ""
145
 
146
  #: includes/admin/class-wc-ecfb-order.php:83
147
  #: includes/admin/class-wc-ecfb-order.php:169
148
  #: includes/admin/class-wc-ecfb-order.php:282
149
+ #: includes/class-wc-ecfb-front-end.php:436
 
 
150
  msgid "Company"
151
  msgstr ""
152
 
162
 
163
  #: includes/admin/class-wc-ecfb-order.php:114
164
  #: includes/admin/class-wc-ecfb-order.php:189
 
 
165
  msgid "City"
166
  msgstr ""
167
 
168
  #: includes/admin/class-wc-ecfb-order.php:118
169
  #: includes/admin/class-wc-ecfb-order.php:193
170
+ #: includes/class-wc-ecfb-front-end.php:94
 
 
171
  msgid "State"
172
  msgstr ""
173
 
174
  #: includes/admin/class-wc-ecfb-order.php:122
175
  #: includes/admin/class-wc-ecfb-order.php:197
 
 
176
  msgid "Country"
177
  msgstr ""
178
 
188
 
189
  #: includes/admin/class-wc-ecfb-order.php:135
190
  #: includes/admin/class-wc-ecfb-order.php:294
 
 
191
  msgid "Phone"
192
  msgstr ""
193
 
194
  #: includes/admin/class-wc-ecfb-order.php:145
195
  #: includes/admin/class-wc-ecfb-order.php:301
 
 
196
  msgid "Email"
197
  msgstr ""
198
 
200
  #: includes/admin/class-wc-ecfb-order.php:253
201
  #: includes/admin/class-wc-ecfb-order.php:327
202
  #: includes/admin/class-wc-ecfb-order.php:330
 
 
203
  msgid "Address"
204
  msgstr ""
205
 
316
  "and Cell Phone."
317
  msgstr ""
318
 
319
+ #: includes/admin/class-wc-ecfb-settings.php:184
320
  msgid "Enable Address Autocomplete:"
321
  msgstr ""
322
 
323
+ #: includes/admin/class-wc-ecfb-settings.php:191
324
  msgid "If checked automatically complete the address fields based on the zip code."
325
  msgstr ""
326
 
327
+ #: includes/admin/class-wc-ecfb-settings.php:199
328
  msgid "Validation:"
329
  msgstr ""
330
 
331
+ #: includes/admin/class-wc-ecfb-settings.php:207
332
  msgid "Validate CPF:"
333
  msgstr ""
334
 
335
+ #: includes/admin/class-wc-ecfb-settings.php:214
336
  msgid "Checks if the CPF is valid."
337
  msgstr ""
338
 
339
+ #: includes/admin/class-wc-ecfb-settings.php:221
340
  msgid "Validate CNPJ:"
341
  msgstr ""
342
 
343
+ #: includes/admin/class-wc-ecfb-settings.php:228
344
  msgid "Checks if the CNPJ is valid."
345
  msgstr ""
346
 
347
+ #: includes/class-wc-ecfb-api.php:255 includes/class-wc-ecfb-api.php:305
348
+ msgid "Number."
349
+ msgstr ""
350
+
351
+ #: includes/class-wc-ecfb-api.php:260 includes/class-wc-ecfb-api.php:310
352
+ msgid "Neighborhood."
353
+ msgstr ""
354
+
355
+ #: includes/class-wc-ecfb-api.php:265
356
+ msgid "Person type."
357
+ msgstr ""
358
+
359
+ #: includes/class-wc-ecfb-api.php:270
360
+ msgid "CPF."
361
+ msgstr ""
362
+
363
+ #: includes/class-wc-ecfb-api.php:275
364
+ msgid "RG."
365
+ msgstr ""
366
+
367
+ #: includes/class-wc-ecfb-api.php:280
368
+ msgid "CNPJ."
369
+ msgstr ""
370
+
371
+ #: includes/class-wc-ecfb-api.php:285
372
+ msgid "IE."
373
+ msgstr ""
374
+
375
+ #: includes/class-wc-ecfb-api.php:290
376
+ msgid "Birthdate."
377
+ msgstr ""
378
+
379
+ #: includes/class-wc-ecfb-api.php:295
380
+ msgid "Gender."
381
+ msgstr ""
382
+
383
+ #: includes/class-wc-ecfb-api.php:300
384
+ msgid "Cell Phone."
385
+ msgstr ""
386
+
387
+ #: includes/class-wc-ecfb-front-end.php:95
388
  msgid "required"
389
  msgstr ""
390
 
391
+ #: includes/class-wc-ecfb-front-end.php:225
392
  msgid "Female"
393
  msgstr ""
394
 
395
+ #: includes/class-wc-ecfb-front-end.php:226
396
  msgid "Male"
397
  msgstr ""
398
 
399
+ #: includes/class-wc-ecfb-front-end.php:256
400
+ #: includes/class-wc-ecfb-front-end.php:369
 
 
 
 
 
401
  msgid "Address line 2"
402
  msgstr ""
403
 
404
+ #: includes/class-wc-ecfb-front-end.php:415
405
+ #: includes/class-wc-ecfb-front-end.php:421
406
+ #: includes/class-wc-ecfb-front-end.php:429
407
+ #: includes/class-wc-ecfb-front-end.php:436
408
+ #: includes/class-wc-ecfb-front-end.php:440
409
+ #: includes/class-wc-ecfb-front-end.php:448
410
  msgid "is a required field"
411
  msgstr ""
412
 
413
+ #: includes/class-wc-ecfb-front-end.php:425
414
+ #: includes/class-wc-ecfb-front-end.php:444
415
  msgid "is not valid"
416
  msgstr ""
417
 
418
+ #: woocommerce-extra-checkout-fields-for-brazil.php:118
419
  msgid "WooCommerce Extra Checkout Fields for Brazil depends on %s to work!"
420
  msgstr ""
421
 
422
+ #: woocommerce-extra-checkout-fields-for-brazil.php:118
423
  msgid "WooCommerce"
424
  msgstr ""
425
 
446
  msgid "http://claudiosmweb.com/"
447
  msgstr ""
448
 
449
+ #: includes/class-wc-ecfb-front-end.php:147
450
+ #: includes/class-wc-ecfb-front-end.php:161
 
 
 
 
 
 
 
 
 
 
 
 
451
  msgctxt "placeholder"
452
  msgid "CPF"
453
  msgstr ""
454
 
455
+ #: includes/class-wc-ecfb-front-end.php:154
456
  msgctxt "placeholder"
457
  msgid "RG"
458
  msgstr ""
459
 
460
+ #: includes/class-wc-ecfb-front-end.php:179
461
+ #: includes/class-wc-ecfb-front-end.php:193
 
 
 
 
 
462
  msgctxt "placeholder"
463
  msgid "CNPJ"
464
  msgstr ""
465
 
466
+ #: includes/class-wc-ecfb-front-end.php:186
467
  msgctxt "placeholder"
468
  msgid "State Registration"
469
  msgstr ""
470
 
471
+ #: includes/class-wc-ecfb-front-end.php:211
 
 
 
 
 
 
472
  msgctxt "placeholder"
473
  msgid "Birthdate"
474
  msgstr ""
475
 
476
+ #: includes/class-wc-ecfb-front-end.php:248
477
+ #: includes/class-wc-ecfb-front-end.php:361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  msgctxt "placeholder"
479
  msgid "Number"
480
  msgstr ""
481
 
482
+ #: includes/class-wc-ecfb-front-end.php:263
483
+ #: includes/class-wc-ecfb-front-end.php:376
 
 
 
 
 
 
484
  msgctxt "placeholder"
485
  msgid "Neighborhood"
486
  msgstr ""
487
 
488
+ #: includes/class-wc-ecfb-front-end.php:289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  msgctxt "placeholder"
490
  msgid "Cell Phone"
 
 
 
 
 
 
491
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: claudiosanches
3
  Donate link: http://claudiosmweb.com/doacoes/
4
  Tags: woocommerce, checkout, brazil, cpf, cpnj, rg, ie
5
  Requires at least: 3.5
6
- Tested up to: 4.4
7
- Stable tag: 3.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -20,7 +20,7 @@ A partir da versão 3.1.0 é feita integração também com a [API](http://docs.
20
 
21
  = Compatibilidade =
22
 
23
- Compatível com as versões 2.2.x, 2.3.x, 2.4.x e 2.5.x do WooCommerce.
24
 
25
  Funciona com os plugins:
26
 
@@ -77,6 +77,13 @@ Você pode contribuir com código-fonte em nossa página no [GitHub](https://git
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
80
  = 3.4.3 - 2016/03/20 =
81
 
82
  * Corrigida as mascaras quando não esta preenchendo um endereço brasileiro.
3
  Donate link: http://claudiosmweb.com/doacoes/
4
  Tags: woocommerce, checkout, brazil, cpf, cpnj, rg, ie
5
  Requires at least: 3.5
6
+ Tested up to: 4.5
7
+ Stable tag: 3.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
20
 
21
  = Compatibilidade =
22
 
23
+ Compatível desde a versão 2.2.x até 2.6.x do WooCommerce.
24
 
25
  Funciona com os plugins:
26
 
77
 
78
  == Changelog ==
79
 
80
+ = 3.4.4 - 2016/06/20 =
81
+
82
+ * Adicionado suporte a nova API REST do WooCommerce.
83
+ * Corrigido localização do campo de CEP na página de editar endereços.
84
+ * Corrigido os campos de bairro e número no método `WC_Order::get_order_address()`.
85
+ * Adicionada compatibilidade com o WooCommerce Correios 3.0.0.
86
+
87
  = 3.4.3 - 2016/03/20 =
88
 
89
  * Corrigida as mascaras quando não esta preenchendo um endereço brasileiro.
woocommerce-extra-checkout-fields-for-brazil.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Extra Checkout Fields for Brazil
4
  * Plugin URI: https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil
5
  * Description: Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail incorreto e auto preenchimento dos campos de endereço pelo CEP.
6
- * Version: 3.4.3
7
  * Author: Claudio Sanches
8
  * Author URI: http://claudiosmweb.com/
9
  * Text Domain: woocommerce-extra-checkout-fields-for-brazil
@@ -12,9 +12,8 @@
12
  * Domain Path: /languages
13
  */
14
 
15
- // If this file is called directly, abort.
16
- if ( ! defined( 'WPINC' ) ) {
17
- die;
18
  }
19
 
20
  if ( ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) :
@@ -29,7 +28,7 @@ class Extra_Checkout_Fields_For_Brazil {
29
  *
30
  * @var string
31
  */
32
- const VERSION = '3.4.3';
33
 
34
  /**
35
  * Instance of this class.
3
  * Plugin Name: WooCommerce Extra Checkout Fields for Brazil
4
  * Plugin URI: https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil
5
  * Description: Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail incorreto e auto preenchimento dos campos de endereço pelo CEP.
6
+ * Version: 3.4.4
7
  * Author: Claudio Sanches
8
  * Author URI: http://claudiosmweb.com/
9
  * Text Domain: woocommerce-extra-checkout-fields-for-brazil
12
  * Domain Path: /languages
13
  */
14
 
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit; // Exit if accessed directly.
 
17
  }
18
 
19
  if ( ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) :
28
  *
29
  * @var string
30
  */
31
+ const VERSION = '3.4.4';
32
 
33
  /**
34
  * Instance of this class.