jhonatanll
Forum Replies Created
-
It also happened to me, if you have any extension deactivate it, update and activate them again.
Forum: Plugins
In reply to: [Geolocation IP Detection] problems and more problems!Well, yes … Spanish hahaha
solved! It was a small mistake of order, thank you!I leave the code here in case anyone is interested in it today or in the future:
add_action(‘wp_head’, ‘ven’, 5);
function ven(){
$userInfo = geoip_detect2_get_info_from_current_ip();
$city = $userInfo->mostSpecificSubdivision->name;
if ($city == ‘Alicante’ || $city == ‘Murcia’ || $city == ‘Valencia’) {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 20 );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
add_action( ‘woocommerce_single_product_summary’, ‘nuevo’, 31 );
add_action( ‘woocommerce_after_shop_loop_item’, ‘nuevo’, 11 );
}
}function nuevo() {
global $product;
$product_type = $product->product_type;
switch ( $product_type ) {
case ‘simple’:
echo ‘Consultar<style>.woocommerce .button { display: none;}</style>’;
break;
case ‘variable’:
echo ‘Consultar‘;
break;
default:
echo ‘Consultar‘;
}
}Forum: Plugins
In reply to: [Geolocation IP Detection] problems and more problems!The code works, I deleted the geolocation code (to be applied without more) and do what I want, the problem is that, in the log, I get the error: “geoip_detect2_get_info_from_current_ip (), is not defined”.
Thanks for the speed and forgiveness for my bad English!