I tried to edit a plugin product price based on country woocommerce-product-price-based-on-countries/includes/class-wcpbc-frontend-pricing.php
I added the below code,in line 36
add_filter( 'woocommerce_get_price_html', 'country_geolocated_based_hide_price', 10, 2 );
function country_geolocated_based_hide_price( $price, $product ) {
// Get an instance of the WC_Geolocation object class
$geo_instance = new WC_Geolocation();
// Get geolocated user geo data.
$user_geodata = $geo_instance->geolocate_ip();
// Get current user GeoIP Country
$country = $user_geodata['country'];
return $country == 'GB' ? '' : $price;
In place GB i used a specific country name.
Because i want to hide prices to that country and display prices to other countries
but it throwed me this error,
Parse error: syntax error, unexpected ‘public’ (T_PUBLIC) in /home/hhclothi/camillerimarine.com/wp-content/plugins/woocommerce-product-price-based-on-countries/includes/class-wcpbc-frontend-pricing.php on line 68
can somebody help me to sort this out. Thank you