Answer the question
In order to leave comments, you need to log in
Why doesn't the woocommerce order go through and asks to enter an address to continue?
I welcome everyone!
Shop on woocommerce. WP engine latest version. The site has Saphali WC Settings installed . I tried to install WooCommerce Checkout Manager to reduce the fields when placing an order, I removed unnecessary fields or did not display them, I even tried to remove all the checkboxes of mandatory fields, but the problem occurs when placing an order on Mozille. In incognito mode in Mozille disappears.
Trying to enter all the fields, and experimenting with different combinations of mandatory and optional fields, they did not lead to stable work. Often gives the error "Please enter an address to continue."
tried to set in funcional.php of theme template the following code
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields[' account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']);
return $fields;
}
?>
after which the site stopped working safely, and I had to make a backup.
Programming buffs and WP and Wocommerce experts - respond.
I am ready to pay a small amount for a practical helping advice. 500 rub.
site www.azia-mix.ru/shop
Answer the question
In order to leave comments, you need to log in
And this is how it is done by hand.
in functions.php we write:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_country']); //удаляем! тут хранится значение страны оплаты
unset($fields['shipping']['shipping_country']); ////удаляем! тут хранится значение страны доставки
return $fields;
}
I had this if I turned off the field with the country (['billing']['billing_country']). As soon as I returned it to the form, everything worked.
The above solutions worked 1 time (for me personally).
Therefore, I solved the problem like this:
1. Create a class in styles:
2. Add a class to the "Country" field:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields )
{
array_push($fields['billing']['billing_country']['class'], "vag-hide"); // Добавляем класс для скрытия поля.
return $fields;
}
There you can not remove the country field
(it must be published)
woocommerce -> Saphali WC -> Manage fields -> Country (Must be published)
Also try disabling shipping fields ['shiping']
// remove shipping fields
unset($fields['shipping']['shipping_first_name']);
unset($fields['shipping']['shipping_last_name']);
unset($fields['shipping']['shipping_company']);
unset($fields['shipping']['shipping_address_1']);
unset($fields['shipping']['shipping_address_2']);
unset($fields['shipping']['shipping_city']);
unset($fields['shipping']['shipping_postcode']);
unset($fields['shipping']['shipping_country']);
unset($fields['shipping']['shipping_state']);
Deleting classes in Woocommerce\Shipping\Shipping classes helped me with such an error
It means that some of the fields contain require = true. do var_dump($fields); and see what.
Further, either it must be removed through unset, or make require = false.
The code that should be inserted at the end of your_site\wp-content\themes\your_theme\functions.php file helped me: before endif;
// Отключаем ненужные поля ввода при заказе
add_filter('woocommerce_checkout_fields','remove_checkout_fields');
function remove_checkout_fields($fields){
//unset($fields['billing']['billing_first_name']);
//unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']); // Отключено
//unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']); // Отключено
unset($fields['billing']['billing_city']); // Отключено
unset($fields['billing']['billing_postcode']); // Отключено
unset($fields['billing']['billing_country']); // Отключено
unset($fields['billing']['billing_state']); // Отключено
//unset($fields['billing']['billing_phone']);
//unset($fields['order']['order_comments']);
//unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']); // Отключено
unset($fields['account']['account_password']); // Отключено
unset($fields['account']['account_password-2']); // Отключено
return $fields;
}
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_country']); // Отключаем страны оплаты
unset($fields['shipping']['shipping_country']);// Отключаем страны доставки
return $fields;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question