Change the Maxmind geolocation database path in WooCommerce 3.9+

The following code snippet will help you change the default MaxMind geolocation database path in WooCommerce v3.9+ here:

The code:

add_filter( 'woocommerce_maxmind_geolocation_database_path', 'woocommerce_new_maxmind_geolocation_database_path' );
function woocommerce_new_maxmind_geolocation_database_path( $database_path ) {
    $upload_dir = wp_upload_dir();
	$database_path = trailingslashit( $upload_dir['basedir'] ) . 'my-new-folder/dbfile.ext'; 
    return $database_path;
}

Remember to replace the my-new-folder/dbfile.ext to match your new path.

 

Was this helpful? Please buy me a coffee




 

This code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update.

Share your thoughts

Your email address will not be published. Required fields are marked *