Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WC Address Book #153

Open
Data-Zombie opened this issue Jan 10, 2024 · 5 comments
Open

WC Address Book #153

Data-Zombie opened this issue Jan 10, 2024 · 5 comments

Comments

@Data-Zombie
Copy link

Data-Zombie commented Jan 10, 2024

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

@matt-h
Copy link
Member

matt-h commented Jan 11, 2024

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.

@Data-Zombie
Copy link
Author

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

@matt-h
Copy link
Member

matt-h commented Feb 13, 2024

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.

@Data-Zombie
Copy link
Author

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?

@Data-Zombie
Copy link
Author

Otherwise if I give you credentials for a staging site can you help me in exchange of a tip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants