首页 > 解决方案 > Wocomerce 使用 GeoIP2 而不是 GeoLite2

问题描述

我正在尝试在 Woocommerce 中使用MaxMind GeoLocation 数据库的付费版本,但找不到一种方法来集成它并像免费版本一样自动更新数据库?

我在课堂上看到WC_Integration_MaxMind_Database_Service有一个过滤器来更新文件的路径,但文件名GeoLite2-Country似乎固定在const

https://woocommerce.github.io/code-reference/files/woocommerce-includes-integrations-maxmind-geolocation-class-wc-integration-maxmind-database-service.html

function plugin_woocommerce_new_maxmind_geolocation_database_path($database_path) {
     $upload_dir = wp_upload_dir();     
     $database_path = trailingslashit($upload_dir['basedir']) . 'GeoIP2-City.mmdb';     
     return $database_path; 
} 
add_filter( 'woocommerce_maxmind_geolocation_database_path', 'plugin_woocommerce_new_maxmind_geolocation_database_path' )

标签: wordpresswoocommercegeolocation

解决方案


推荐阅读