【问题标题】:showing custom field values in Wocommerce my-address view section在 Woocommerce 我的地址视图部分显示自定义字段值
【发布时间】:2021-02-26 17:33:08
【问题描述】:

我在 woocommerce 的帐户页面的 myaddress 编辑部分中添加了自定义字段。但我在地址显示部分中没有看到它。我怎么也可以在那里显示它。只有公司、名字、姓氏、帐单地址 1 ,帐单地址 2,显示的是州城市和国家。如何更改。

【问题讨论】:

    标签: woocommerce account


    【解决方案1】:
           add_filter( 'woocommerce_my_account_my_address_formatted_address', function( 
               $args, $customer_id, $name ){
               // the phone is saved as billing_phone and shipping_phone
                   $args['area'] = get_user_meta( $customer_id, $name . '_area', true );
                   return $args;
                 }, 10, 3 ); 
    
    
                  add_filter( 'woocommerce_localisation_address_formats', function( $formats ) 
     {
                  foreach ( $formats as $key => &$format ) {
                   // put a break and then the phone after each format.
                    $format .= "\n{area}";
                       }
                 return $formats;
                 } );
    

    【讨论】:

    • 这就是我正在寻找的
    猜你喜欢
    • 2019-07-21
    • 2018-03-18
    • 2019-07-28
    • 2016-04-22
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    • 2021-10-06
    • 1970-01-01
    相关资源
    最近更新 更多