Woocommerce Checkout原始字段设置

时间:2019-01-29 12:44:15

标签: php wordpress woocommerce field checkout

有人知道Woocommerce插件文件中原始结帐字段设置在哪里吗?例如原始字段标签和占位符等?

2 个答案:

答案 0 :(得分:1)

  

Woocommerce中没有无Checkout字段设置 ...

     

但是您可以使用以下内容自定义它们
  -The Woocommerce Developer Documentation reference to customize checkout fields
  -或any of the availaible plugins其中大多数是商业广告。

1)结帐字段基本上由3个Woocommerce类管理:
-WC_Checkout使用get_checkout_fields() method (和get_value()方法)的类
-WC_Countries使用get_default_address_fields() methodget_address_fields() method的类
- WC_Customer类也用于“我的帐户地址”字段。

并使用woocommerce_form_field() template function定义了不同的字段类型。

2)定制中涉及的主要钩子是:
-woocommerce_default_address_fields过滤器挂钩和StackOverFlow related threads
-woocommerce_checkout_fields过滤器挂钩和StackOverFlow related threads
-woocommerce_billing_fields过滤器挂钩和StackOverFlow related threads
-woocommerce_shipping_fields过滤器挂钩和StackOverFlow related threads
-woocommerce_form_field_{$args\[type\]}过滤器挂钩和StackOverFlow related threads

3)涉及的主要相关模板 that can be overridden through via the theme是:
-checkout/form-checkout.php
-checkout/form-billing.php
-checkout/form-shipping.php
-checkout/form-loging.php

相关Template structure & Overriding templates via a theme

答案 1 :(得分:0)

For Original Fields please visit on your "woocommerce/templates/checkout/form-billing.php"

Here you will see a function
//This below line of code is responsible to get the fields
$fields = $checkout->get_checkout_fields( 'billing' );

//this below code is resposnible to echo those fields/labels etc
woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );

If you want to go in depth please visit woocommerce/includes/wc-template-fucntions.php "function woocommerce_form_field( $key, $args, $value = null )", check this.

希望这可以帮助您!