WooCommerce 更改表单标签并删除字段 [英] WooCommerce Change Form Labels and Remove Fields

查看:30
本文介绍了WooCommerce 更改表单标签并删除字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自定义 WooCommerce 结帐页面,如何编辑字段标签?

I'm trying to customise WooCommerce checkout page, how can I edit field labels?

另外,如何从表单中删除 2 个字段?我不需要 CompanyState 字段.

Also, how can I remove 2 fields from the form? I don't need Company and State field.

推荐答案

我建议制作一个自定义插件来修改它,以便您以后可以轻松升级 WooCommerce.

I recommend making a custom plugin that modifies this so you can easily upgrade WooCommerce at a later date.

在您的自定义插件中,实现此处找到的一些代码:http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/

In your custom plugin, implement some of the code found on here: http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/

例如,删除公司和州:

// Hook in
add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' );
// Our Hooked in function - $fields is passed via the filter
function custom_override_checkout_fields( $fields) {
    unset($fields['shipping']['shipping_state']);
    unset($fields['shipping']['shipping_company']);
    return $fields;
}

如果您在制作插件时需要帮助,我制作了有关如何将自定义字段添加到产品页面的指南.我认为在这种情况下它可能会有所帮助.http://www.xatik.com/2013/02/06/add-custom-form-woocommerce-product/

If you need help making a Plugin, I made a guide on how to add custom fields to the Product page. I think it might be helpful in this context. http://www.xatik.com/2013/02/06/add-custom-form-woocommerce-product/

这篇关于WooCommerce 更改表单标签并删除字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆