I need to add 'global $woocommerce;' in the wordpress my-ac-plugin.php to pull in the users country code for my caching but I'm getting a 500 error.
Does anyone know how I can do this, or any ideas what's wrong?
Here's my code...
if (!defined('WPINC')) {
exit('Do NOT access this file directly.');
}
function my_ac_plugin()
{
$ac = $GLOBALS['comet_cache_advanced_cache'];
$ac->addFilter('comet_cache_version_salt',
'my_ac_version_salt_shaker');
}
function my_ac_version_salt_shaker($version_salt)
{
global $woocommerce;
$customer_country = $woocommerce->customer->get_country();
$version_salt .= $customer_country;
geoip_close($gi);
return $version_salt;
}
my_ac_plugin();
Follow these steps to help in troubleshooting:
define('WP_DEBUG', false);
The next time you refresh the page you were getting an error on you should now see more descriptive error messages which will help in troubleshooting.