【问题标题】:WooCommerce reverse behavior of Ship to different address checkbox?运送到不同地址复选框的 WooCommerce 反向行为?
【发布时间】:2015-08-25 10:05:58
【问题描述】:

我想取消结帐页面上“运送到其他地址”复选框的行为。选中后,运输表格会隐藏,帐单表格会获取信息。我在 checkout.js 中找到并更改了这一行

$( 'div.shipping_address' ).hide();
if ( $( this ).is( ':checked' ) ) {
    $( 'div.shipping_address' ).slideDown();
}

$( 'div.shipping_address' ).slideDown();
if ( $( this ).is( ':checked' ) ) {
    $( 'div.shipping_address' ).hide();
}

它工作正常(显示为反向)但是当我们下订单时,运输表格数据也会更新。如何解决?

【问题讨论】:

    标签: wordpress woocommerce


    【解决方案1】:

    以下代码将阻止在下订单期间更新运输表单数据

    add_action('woocommerce_checkout_fields', 'woo_optional_fields');
        function woo_optional_fields($wcCheckout_fields) {
            if(//check your shipping condition here){       
                //unset your shipping fields manually here..!!!
                unset($wcCheckout_fields['shipping']['your_all_shipping_fields']);
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-06
      • 2021-05-08
      • 2019-05-13
      • 1970-01-01
      • 2020-01-22
      • 1970-01-01
      • 2018-03-17
      • 1970-01-01
      相关资源
      最近更新 更多