从结账中删除/删除详细信息 WooCommerce (邮政编码、公司、电话...)

WooCommerce 对于想要创建一个 网上商店中,基于 WordPress.
安装后 default, WooCommerce 将添加账单详细信息的标准表格。 在客户的“结帐”页面中。
设计为一个系统 网上商店 它允许交付物理产品和下载虚拟产品, WooCommerce 询问 标准形式 一系列客户数据:名字,姓氏,电话号码,国籍,地址,城市, 邮政编码。 有些领域我们需要例如虚拟命令。 这是由贝支付可以下载或产品A产品将不需要用于传递数据。 在这种情况下,最好是缓解控制系统对于用户来说,通过除去结帐的领域。

删除“邮政编码”字段 WooCommerce 结算

能够删除“邮政编码”/帐单邮政编码 WooCommerce,我们需要去编辑主题的functions.php文件 WordPress 在网站上处于活动状态。 在functions.php中,我们添加以下行:

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_postcode']);
return $fields;
}

其中“billing_postcode”是邮政编码字段。 如果我们想删除第二个地址字段,我们会将“billing_postcode”替换为“billing_addres_2”。

 unset($fields['billing']['billing_address_2']);

有迹象表明,可能不感兴趣的客户付款的任何细节情况。 通常,当支付通过贝宝。 在这种情况下,我们可以选择消除订单页面的所有领域。

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_email']);
unset($fields['billing']['billing_city']);
return $fields;
}

这样您将删除其中的所有字段 WooCommerce 结帐。

作为科技爱好者,我从2006年开始在StealthSettings.com上愉快地撰写文章。我在操作系统方面有丰富的经验,包括macOS、Windows和Linux,还熟悉编程语言和博客平台(WordPress),以及在线商店平台(WooCommerce、Magento、PrestaShop)。

如何以 » 网络 » 从结账中删除/删除详细信息 WooCommerce (邮政编码、公司、电话...)

关于“从结账中删除/删除详细信息”的 6 个想法 WooCommerce (邮政编码、公司、电话...)”

  1. Bonjour Merci的职位!
    我需要删除公司名称,这很奏效!
    我也想删除“运送到其他地址”上的公司名称。
    但我不知道如何在您的代码中替换custom_override_checkout_fields。 你可以帮帮我吗?

    回复
  2. 嗨,我 add按照指导将此代码编辑到functions.php,但我的网站崩溃了。 完全是空白。 我对这样的东西并不完全陌生,但我也不是专业人士。

    如果我可以访问我的仪表板,我只是将其删除,但我根本无法访问我网站上的任何内容。

    请帮忙,我该怎么办? 请紧急响应!

    回复
  3. 你好
    Benödemekısmındaki“ fatura bilgileri”yazısını“ teslimat adresi” olarakdeğiştirmekistiyorum。 不是yapabiliriz。

    回复
    • 你好,
      是的,这在定制器中是个好主意,但在 latest Woo 的版本我只看到“address 2”,“公司”。 对于邮政编码和其他字段,需要隐藏需要的函数代码。

      回复
发表评论