woo-address-book
woo-address-book copied to clipboard
WC Address Book
Hello Matt,
Woocommerce endpoint for billing and shipping addresses is profile/addresses I did't like this structure and I would like to show some informations like Last 5 orders and shipping address on profile. With the help of elementor I have created the template but under address book I didn' find a way to retreve the second, third and so on addresses. There is any hook to show adress list on the profile page insted profile/addresses?
Just some screen that may help: profile (my template)--> https://ibb.co/rfXGgXY profile/addresses--> https://ibb.co/Jc3JFqx my goal--> https://ibb.co/2ZDhBtk
Can you assist me. I can buy a coffeeeee....!!!
Thanks
Using WC_Address_Book->get_instance()->wc_address_book_page( 'billing' ); and WC_Address_Book->get_instance()->wc_address_book_page( 'shipping' ); calls will pull the address book templates into your page. You can override the templates in your theme if you like.
That might get you started on the right path.
Or, you can get the address book data directly with WC_Address_Book->get_instance()->get_address_book( get_current_user_id(), 'billing' ) if you want to access the data directly to use how you want.
Sorry for the late reply Matt, when you have time can you give me a snippet for WC_Address_Book->get_instance()->wc_address_book_page( 'shipping' ); and a snippet for WC_Address_Book->get_instance()->get_address_book( get_current_user_id(), 'shipping' ) ?? Thanks
For the first, just whatever hook you have available to put it on your page
add_action( 'whatever-hook', function () { WC_Address_Book->get_instance()->wc_address_book_page( 'shipping' ) } );
So replace the name of the hook with what you have available.
WC_Address_Book->get_instance()->get_address_book( get_current_user_id(), 'shipping' ) just returns an array of address data. So you would use that if you are coding your own address page/layout and wanted to get the data to use in a custom way.
I have some trouble with coding but I have a question: The list of shipping addresses are visible to the endpoint account -> addresses. Il possible to chenge the page where to show the list of shipping addresses from the plugin?
Otherwise if I give you credentials for a staging site can you help me in exchange of a tip?