WooCommerce Checkout fields settings and customization hooks

后端 未结 2 1437
无人共我
无人共我 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:12
    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.
    

    Hope this may help you out!

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题