Score:0

Theming User Address Book Page

ru flag

We are using drupal commerce2 on drupal 9, and I am trying to theming the address book tab (add some classes to layout and fields), /user/*/address-book.

Unfortunately there isn't any twig template in commerce module, anybody knows how to do this (CSS is ok, but I prefer to use twig)?

Score:0
ng flag

As you mention there is no template specified for this on Commerce, the controller \Drupal\commerce_order\Controller\AddressBookController::overviewPage is composing the address book response using details/containers. You can provide your own controller which will return a template instead (see how to override a controller for a route) so you can deal with it in your theme.

Also, you can do is theme the profile entity which is being rendered per address. Since profiles are entities, you can configure the profile display to your needs.

Samuran Wong avatar
ru flag
Works like a charm, you are my hero, thank you very much!
ng flag
Please, consider checking the answer as "Correct" and upvote if works for you, so others can find it through search engines.
Samuran Wong avatar
ru flag
Sorry for late, I've checked it as correct, could not upvote it though due to reputation
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.