0

Drupal 8.8.1 with commerce 2 installed.

Goal is to make better use of the ‘logged-in user’ landing page(My Account) by adding blocks of useful content.

Blocks created using the UI as well as coded blocks, which are placed into the Content region via structure>block layout>place block, all show up in the My Account user landing page, no problem.

However, the blocks also show up in each of the tabs added by commerce 2, eg Payment Methods and Orders(a list of the logged-in user’s orders), and any additional tabs(My New Tab) which I add from code. (So, it’s not a commerce2 issue).

In block layout, I have set Role Restriction to Authenticated Users, and Page Restriction is /user/* .

So, I’m obviously missing something about how to constrain the display of blocks in tabs.

How do I constrain my blocks display to only show up as required on a subset of the tabs on the 'My Account' user landing page?

Thanks.

  • user/* will match anything under the user/ path. You may want to try using user/*/view to get the My Account page, that may work. – Kevin Mar 6 at 19:15
  • Tried that. If Page Restriction is set to /user/*/view, the block does not show up on any tab. Other ideas? thx for replying – Russellt Mar 6 at 21:12
  • Tabs have a path. You'll have to add the path for the tabs as well. – Jaypan Mar 6 at 23:43
  • Thx for ideas. I was fixated on finding a coding solution, but the solution was in theme. Add a new ‘logged-in user ‘ region, add page- -user twig template to display the new region, drop the blocks into the new region and set their visibility to negate the user tab paths where I don’t want the blocks to display. Drupal is so flexible, solutions come from unexpected directions. – Russellt Mar 9 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.