问题描述
有人可以告诉我如何从woocommerce中删除特定国家/地区。 woocommerce中有一个选项,表示与所有国家/地区和特定国家/地区一起销售地点。
Can someone tell how can I remove the specific country from woocommerce. There is option in woocommerce that said selling locations with All countries and specific.
但是我想向除美国以外的所有国家/地区销售(例如美国)!那么如何将美国从国家/地区列表中删除。好像我使用特定国家/地区选项一样,那么我将不得不添加除美国之外的所有国家/地区,这是一个较长的过程。
However I want to sell to all countries except the 1 country that is US for example! then how can I remove US from the countries list. As if I use "specific countries" option then I will have to add all the countries except the US which is longer process.
是否有任何可以帮助我使用的代码可以放入主题功能,以便在结帐时美国国家/地区不会出现在国家列表中?
Is there any code you can help me with that I can put into functions of theme so that US country will not appear in the list of countries during checkout?
推荐答案
尝试以下代码段
function woo_remove_specific_country( $country )
{
unset($country["US"]);
return $country;
}
add_filter( 'woocommerce_countries', 'woo_remove_specific_country', 10, 1 );
参考
这篇关于如何在WooCommerce中删除特定国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!