Display woocommerce billing address on a custom page
-
I’d like to display the billing address on a custom page on my site. This page contains a list of users with some of their registered information, but I would also like to display address information these users…
To do this, I created a custom template with this code:
<?php /* Template Name: List Users */ get_header(); ?> <div id="primary"> <main id="main" class="site-main" role="main"> <div id="pageTitle"> <h2>Onde Comprar</h2> </div> <div id="pageText"> A Editora Conclave distribui e tem parcerias com vários lojistas pelo Brasil, você pode localizar a loja mais próxima a você ou se preferir poderá comprar na nossa loja virtual, <a href="https://conclaveweb.com.br/loja/">clicando aqui</a>. </div> <div id="searchContainer"></div> <ul id="userListContainer"> <?php // WP_User_Query arguments $args = array( 'meta_key' => 'first_name', 'role' => 'shopkeeper', //'search' => 'first_name', 'search_columns' => array('first_name', 'city', 'state'), 'order' => 'ASC', 'orderby' => 'meta_value', 'fields' => 'all_with_meta', ); // The User Query $users = new WP_User_Query($args); // User Loop if (!empty($users->results)) { foreach ($users->results as $user) { echo //get_author_posts_url( $user->ID ) . the_author_meta( 'user_url', $user->ID ) . '<li>' . '<a href="' . esc_url(get_author_posts_url($user->ID)) . '">' . '<div id="userImage">' . get_avatar($user->ID) . '</div>' . '<div id="userInfo">' . esc_attr($user->first_name) . ' ' . esc_attr($user->last_name) . '<br>' . 'CEP: ' . esc_attr($user->post_code) . ' — ' . esc_attr($user->city) . ', ' . esc_attr($user->state) . '<br>' . '</a>' . '<a href="' . esc_attr($user->user_url) . '">' . esc_attr($user->user_url) . '</a>' . '</div>' . '</li>'; } } else { echo 'Nenhum usuário encontrado.'; } ?> </ul> </main><!-- #main --> </div><!-- #primary --> <?php //do_action( 'ekommart_sidebar' ); get_footer(); ?>
I tryed display the address, but don`t work. I believe that dont work because this informations does not come by “WP_User_Query”, but do not know how bring them.
Any help will be welcome! Thank’s!!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Display woocommerce billing address on a custom page’ is closed to new replies.