/**
* Filter user IP to check if it is whitelisted.
* For whitelisted IPs, hCaptcha will not be shown.
*
* @param bool $whitelisted Whether IP is whitelisted.
* @param string $ip IP.
*
* @return bool
*/
function my_hcap_whitelist_ip( $whitelisted, $ip ) {
// Whitelist local IPs.
if ( false === $ip ) {
return true;
}
// Whitelist some other IPs.
if ( '1.1.1.1' === $ip ) {
return true;
}
return $whitelisted;
}
add_filter( 'hcap_whitelist_ip', 'my_hcap_whitelist_ip', 10, 2 );
Issue is that, this code does not hide hCaptcha from the from but just allows the submission without attempting it. ( Form submits without any issues even if you don’t attempt hCaptcha ).
We want it to be hidden as it actually gets hidden when we add IP address manually in the whitelist settings field.
Thanks!
add_filter ( ‘woocommerce_account_menu_items’, ‘wptips_customize_account_menu_items’ );
function wptips_customize_account_menu_items( $menu_items ){
// Chnage the Menu Item name text
$menu_items[‘edit-address’] = ‘Indirizzi’; //Rename ‘Addresses’ to ‘Indirizzi’
return $menu_items;
}
Hope to get a fast answare back.
Mirko
]]>The field is removed, but I noticed an error. When I add a product and go to the cart page to simulate shipping, the address is shown correctly, but when I go to the checkout page and return to the cart page, the undefined value is added to the address. This only happens because of the removal of address 2.
I’ve already tried using the woocommerce_default_address_fields, woocommerce_billing_fields, woocommerce_shipping_fields and woocommerce_checkout_fields filters. I’ve also disabled plugins that may be related to WooCommerce.
This is the most recent code from my attempts:
add_filter( 'woocommerce_billing_fields' , 'custom_billing_fields' );
function custom_billing_fields( $fields ) {
unset($fields ['billing_company']);
$fields['billing_neighborhood']['label'] = 'Bairro';
$fields['billing_number']['class'] = array( 'form-row-first', 'address-field' );
$fields['billing_phone']['class'] = array( 'form-row-first', 'address-field' );
$fields['billing_cpf']['class'] = array( 'form-row-last', 'person-type-field', 'validate-required' );
$fields['billing_neighborhood']['class'] = array( 'form-row-first', 'address-field' );
$fields['billing_email']['priority'] = 21;
$fields['billing_phone']['priority'] = 22;
$fields['billing_number']['priority'] = 60;
$fields['billing_neighborhood']['priority'] = 75;
$fields['billing_neighborhood']['required'] = true;
return $fields;
}
add_filter( 'woocommerce_shipping_fields' , 'custom_shipping_fields' );
function custom_shipping_fields( $fields ) {
unset($fields ['shipping_company']);
$fields['shipping_neighborhood']['label'] = 'Bairro';
$fields['shipping_number']['class'] = array( 'form-row-first', 'address-field' );
$fields['shipping_neighborhood']['class'] = array( 'form-row-first', 'address-field' );
$fields['shipping_number']['priority'] = 60;
$fields['shipping_neighborhood']['priority'] = 75;
$fields['shipping_neighborhood']['required'] = true;
return $fields;
}
add_filter( 'woocommerce_default_address_fields', 'custom_default_address_fields' );
function custom_default_address_fields( $fields ) {
unset($fields['address_2']);
if(is_account_page() || is_checkout()) {
$fields['postcode']['class'] = array( 'form-row-first', 'address-field' );
$fields['address_1']['class'] = array( 'form-row-last', 'address-field' );
$fields['city']['class'] = array( 'form-row-last', 'address-field' );
$fields['state']['class'] = array( 'form-row-last', 'address-field' );
}
return $fields;
}
I’ve tried using $unset($fields[‘billing_address_2’]); in the ‘woocommerce_billing_fields’ filter, $unset($fields[‘shipping_address_2’]); in the filter ‘woocommerce_shipping_fields’ and $unset($fields[‘billing’][‘billing_address_2’]); $unset($fields[‘shipping’][‘shipping_address_2’]); in the ‘woocommerce_checkout_fields’ filter.
None of the attempts worked. Every time I recalculate in the cart, the address appears correctly (but I noticed that it only asks/shows the city). When I go to the checkout page and return to the cart, the street address is also added, but with the undefined that comes from address 2.
]]>The site has been working fine for a number of years but recently people with a ‘non-local’ address cannot place an order using a local shipping address (e.g. someone in another country ordering a gift to be delivered to a friend), during check out the website asks for shipping address, in which they enter a correct/valid local address, then it goes to Paypal where they enter their CC info and their billing address (which is non-local), but then the order fails and it shows the error that it cannot be shipped to this address.
As if the billing address in Paypal is being sent as a shipping address.
In the meantime, I have change the WooCommerce setting to ship to all addresses, so now ‘non-locals’ can actually place/pay for orders, however this is still an issue because the shipping zones are based on the shipping postal code, so even if the customer enters a local address, because they Paypal billing address is not local its not matching the postal codes in the shipping zones and there fore they cannot choose a shipping option.
Any advise appreciated
]]>Problem:
“Addresses” text not translated on account page.
Caused by:
includes/wc-account-functions.php: 102. row: 'edit-address' => _n( 'Address', 'Addresses', ( 1 + (int) wc_shipping_enabled() ), 'woocommerce' ),
So address has a singular and plural text to translate (Address and Addresses), but in po/mo file these are change:
msgid "Addresses"
msgid_plural "Address"
msgstr[0] "…"
msgstr[1] "…"
To change in po / mo rows text is not acceptable:
woocommerce.po:21543: duplicate message definition…
woocommerce.po:13622: …this is the location of the first definition