doujiena0025 2019-08-12 22:10
浏览 112
已采纳

基于Geolocation的自定义重定向,适用于WooCommerce中的多个国家/地区

Based on "Custom Redirection based on Geolocation for specific products in WooCommerce" answer to my previous question, I should need the country condition to be an array of values instead.

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • doupaimo8288 2019-08-13 07:54
    关注

    To handle multiple countries you must replace in the condition:

    WC_Geolocation::geolocate_ip()['country'] === 'GE'
    

    by:

    in_array( WC_Geolocation::geolocate_ip()['country'], array( 'GE', 'UK', 'FR' ) )
    

    where array( 'GE', 'UK', 'FR' ) is the array of country codes.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?