WooCommerce Checkout fields settings and customization hooks

后端 未结 2 1507
无人共我
无人共我 2020-12-20 01:00

does anyone know where the original checkout field settings are, within the Woocommerce plugin files? E.g The original field labels and placeholders etc?

2条回答
  •  情深已故
    2020-12-20 01:31

    There is no Checkout fields settings in Woocommerce…

    But you can customize them using:
    - The Woocommerce Developer Documentation reference to customize checkout fields
    - or any of the availaible plugins which most of them are commercial.

    1) Checkout fields are managed essentially by 3 Woocommerce classes:
    - WC_Checkout Class using get_checkout_fields() method (and get_value() method)
    - WC_Countries Class using get_default_address_fields() method and get_address_fields() method
    - WC_Customer Class used also for My account Address fields.

    And uses woocommerce_form_field() template function where the different field types are defined.

    2) The main hooks involved in customizations are:
    - woocommerce_default_address_fields filter hook and StackOverFlow related threads
    - woocommerce_checkout_fields filter hook and StackOverFlow related threads
    - woocommerce_billing_fields filter hook and StackOverFlow related threads
    - woocommerce_shipping_fields filter hook and StackOverFlow related threads
    - woocommerce_form_field_{$args\[type\]} filter hook and StackOverFlow related threads

    3) The main related templates involved that can be overridden through via the theme are:
    - checkout/form-checkout.php
    - checkout/form-billing.php
    - checkout/form-shipping.php
    - checkout/form-loging.php

    Related: Template structure & Overriding templates via a theme

提交回复
热议问题