首页 > 解决方案 > 根据 WooCommerce 中选择的状态显示或隐藏结帐邮政编码字段

问题描述

在 Woocommerce 中,如果选择了特定的状态字段,我会尝试隐藏结帐邮政编码字段。

我正在关注此代码:Show or hide checkout postcode field based on selected city in WooCommerce

此代码由 @LoicTheAztec 爵士编写,我更改了这些值

jQuery(function($){
            var bc   = '#billing_city_field input',
                sc   = '#shipping_city_field input',

jQuery(function($){
            var bc   = '#billing_state_field input',
                sc   = '#shipping_state_field input',

但它不起作用。

我希望当州为纽约时显示邮政编码(带有必填字段),而对于所有其他州,它将隐藏。

需要帮忙。问候。

标签: javascriptphpajaxwordpresswoocommerce

解决方案


推荐阅读