简体   繁体   English

Woocommerce在结帐时隐藏地址字段

[英]Woocommerce hide address fields on checkout

I have a tricky client who wants to hide customer address fields from his users on the woocommerce checkout page. 我有一个棘手的客户,他想在woocommerce结帐页面上向其用户隐藏客户地址字段。

Address fields that need to be hidden but posted: 需要隐藏但已发布的地址字段:

截图

Unfortunately, I need the user address posted and appended to the order. 不幸的是,我需要发布并附加到订单的用户地址。 My backend automation process relies on an address coming in with the order. 我的后端自动化流程依赖于订单中附带的地址。 The address is always the same so the content is not important. 地址始终相同,因此内容并不重要。

I have been looking for a hook or filter that can sort this out, but to no avail. 我一直在寻找可以解决这个问题的钩子或过滤器,但无济于事。

Any help would be saving many bacons. 任何帮助将节省许多培根。

If the address is always the same I'd suggest using JavaScripts hide function on whichever of those inputs you need hidden, and then hard coding the address prior to back end processes starting. 如果地址总是相同,我建议您在需要隐藏的所有输入中使用JavaScript隐藏函数,然后在后端进程启动之前对地址进行硬编码。

So instead of retrieving them via $POST - you could set the values at that point. 因此,您可以在那一刻设置值,而不是通过$POST检索它们。

This is a basic example of the jQuery hide functionality that you could use on page load. 这是可在页面加载时使用的jQuery隐藏功能的基本示例。

Alternatively do you have access to the input boxes on the form? 另外,您是否可以访问表单上的输入框? Could you not use <input type="hidden" value="hardcoded value"></input> 您是否不能使用<input type="hidden" value="hardcoded value"></input>

http://www.w3schools.com/jquery/jquery_hide_show.asp http://www.w3schools.com/jquery/jquery_hide_show.asp

Would either of these work for you? 这些都对您有用吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM