I am developing a small script for woocommerce, where according to the geolocation and product category, show or hide the price.
In this case I managed to make it work by means of geolocation to hide the price, but this is very generic because it affects all products, my goal is to be able to select in which categories it applies.
The first option works without problem
$userInfo = geoip_detect2_get_info_from_current_ip();
if (($userInfo->city->name == 'Alicante' || $userInfo->city->name =='Bilbao')
{
codigo a ejecutar
}
else {
codigo a ejecutar
}
In this case with has term I can determine in what category I want it to be applied, but for some reason it tells me that the first bracket is left over {, I have reviewed documentation and I am not able to find the error.
$userInfo = geoip_detect2_get_info_from_current_ip();
if (($userInfo->city->name == 'Alicante' || $userInfo->city->name =='Bilbao') && ( has_term( array( 'pantalones',), 'product_cat'))
{
codigo a ejecutar
}
else {
codigo a ejecutar
}