Add additional fields to Admin User under Customer shipping section in Woocommerce

前端 未结 1 1204
余生分开走
余生分开走 2021-01-17 00:34

In woocommerce, after creating and registering some custom account fields in a custom php file using the following code:

相关标签:
1条回答
  • 2021-01-17 01:21

    If you want to include your custom "Shipping phone" field in Backend User profile under "Customer's shipping address" section, you will use the following instead:

    add_filter( 'woocommerce_customer_meta_fields', 'filter_add_customer_meta_fields', 10, 1 );
    function filter_add_customer_meta_fields( $args ) {
        $args['shipping']['fields']['shipping_phone'] = array(
            'label'       => __( 'Shipping phone', 'woocommerce' ),
            'description' => '',
        );
        return $args;
    }
    

    Code goes in function.php file of your active child theme (or active theme). Tested and works.

    This little code snippet will do it all. If you change the value in this "Shipping phone" field, it will be updated without needing any additional code.

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