billing_state
or shipping_state
in the code) will sometimes disappear depending on the “Country / Region” that’s selected.
My question is: where can I find the list of countries that, when selected, the shipping_state
field disappears?
Ideally, I’d like a link to the correct file and line in the WooCommerce sourcecode that defines which countries require shipping_state
and which do not.
I know that the billing country is assigned if GEOLOCATE is chosen in woocommerce settings.
The question is. Is the same thing happening with BILLING_STATE?
If not, is it possible to leave state unselected with a placeholder text: Pick you state
Thanks,
]]>Im creating a plugin for connect Prestashop & Woocommerce. When I create a new user I update this customer with Woocommerce fields with update_user_meta like this:
update_user_meta( $user_id, “billing_email”, $customer[’email’] );
But I dont know what data type I need to billing & shipping state.
I know that is a string data, but with ISO Code like Contries or full State name?
update_user_meta( $user_id, “billing_state”, $customer[‘state’]);
What data type is $customer[‘state’]?
Best regards
]]>How is it possible that I manage to disable every single billing field in the checkout page except the billing_state field?
add_filter( 'woocommerce_checkout_fields' , 'custom_checkout_fields' );
function custom_checkout_fields( $fields ) {
$fields['billing']['billing_postcode']['custom_attributes']['disabled'] = 'disabled';
$fields['billing']['billing_city']['custom_attributes']['disabled'] = 'disabled';
$fields['billing']['billing_state']['custom_attributes']['disabled'] = 'disabled';
return $fields;
}
I use the code above… working on every field except the billing_state field.
I allready tried the billing_country field because this is a select field too and maybe it has something to do with that but the billing_country field is disabled too.
Anyone had an idea why this function doesn’t work on my billing_state field in de checkout?
Any suggestions would be welcome because I am a bit lost here.
Kind regards.
]]>My woocommerce powered website is working fine. I love the extension.
But, in order to have the same tax for every client (us selling only in Romania), even if the client is visiting incognito or via VPN, we set up the tax based on the store location.
All good with the tax, now having the same one for all clients; but here comes the problem:
in the checkout page, at the billing_state field, it is completed automatically with the state of our store, so some of the clients oversee that and submit the order with the wrong state.
I would like to find a solution for the field to be empty, and the client should not be able to finalize the order until the field is populated by the client.
If that means for me to modify the tax section i would accept that, as long as anyone visiting the website, from anywhere, would see the same price, and have the same tax.
Thank you!
PS: I am willing to update to the latest wordpress and woo for this, now being a bit older.
]]>after many hours trying to override this field via functions.php on the template i found that For Greece on the file: woocommerce\includes\class-wc-countries.php
the field state is not required:
‘GR’ => array(
‘state’ => array(
‘required’ => false,
),
),
If i set this field to required => true and upload it the system works as expected so there is no issue with any plugin or template.
I would like to solve this without a core hack of course and my two functions do not work do you have something to suggest perhaps?
add_filter( ‘woocommerce_checkout_fields’, ‘custom_override_default_address_fields’ );
function custom_override_default_address_fields($fields){
global $woocommerce;
$country = $woocommerce->customer->get_country();
if($country == ‘GR’){
$fields[‘billing’][‘state’][‘required’] = true;
$fields[‘shipping’][‘state’][‘required’] = true;
}
return $fields;
}
add_filter( ‘woocommerce_billing_fields’, ‘formulare_filter_billing_state’, 10, 999 );
function formulare_filter_billing_state( $address_fields ) {
$address_fields[‘billing_state’][‘required’] = true;
return $address_fields;
}
It looks like these fields are excluded for some reason.
]]>necesito que el campo “billing_state” muestre la info de comuna.
esto es un error de tu plugin, woocommerce u otro?
es lo unico que me falta para entregar este proyecto que ya llevo 2 a?os sin poder cerrar. (mi primero y creo ultimo que hago).
]]>wir haben ein Problem mit der Paypal Schnittstelle. Immer wenn ein anderes Land als “DE” ausgew?hlt wird, bleibt state leer im Request leer. Im log sehe ich folgende Fehlermeldung:
[12-02-2018 11:40:12] Inpsyde\Lib\PayPal\Core\PayPalHttpConnection : ERROR: Got Http response code 400 when accessing https://api.paypal.com/v1/payments/payment/PAY-XXXXXXXXXXXXXXXXXXXXX. {"name":"VALIDATION_ERROR","details":[{"field":"state","issue":"Required field missing"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"xxxxxxxxxxxx"}
[12-02-2018 11:40:44] Inpsyde\Lib\PayPal\Core\PayPalHttpConnection : INFO: POST https://api.paypal.com/v1/payments/payment
Wir hatten diese Problem bei Paypal (ohne Plus) in den letzten zwei Jahren nicht. Diese Problem tauchte jetzt mit dem Paypal Plus Plugin auf.
Die Kunden k?nnen nicht über Paypal zahlen. Muss ich im Backend etwas umstellen?
WordPress: v.4.9.1
Woocommerce: v.3.2.6
Vielen Dank.
Beste Grü?e
BigBoxBerlin
]]><?php echo $current_user->billing_country; ?>
to display the Woocommerce user billing country. This for example echo’s as AU if the customer has an Australian billing address. However, I would like to pull the full name in place of the country code.
The same applies for the billing_state. Instead of getting South Australia I get SA. Have made work through functions.php, however only if I add each state and country. This is obviously a great undertaking to map the worlds states to the state codes.
I believe I have done this before in a very simple way, but for whatever reason cannot figure it out at this moment.
The country and state are being used within a disable input field as the value
<input type="text" class="form-control" value="<?php echo $current_user->billing_country; ?>" disabled="">
Cheers
]]>