Help with Shopify Customer Account UI Extensions – Multiple Components on Same Page & Placement Issues

Hey there, I’m working on Shopify Customer Account UI Extensions and I’m stuck on two issues. Hoping someone here can help clarify things.

1. Multiple components on the same target

I’m trying to render two separate components at different positions on the same profile page. Here’s an excerpt from my shopify.extension.toml file:


[[extensions.targeting]]

module = "./src/components/ProfilePointsDescription.tsx"

target = "customer-account.profile.block.render"

default_placement = "PROFILE1"



[[extensions.targeting]]

module = "./src/components/ProfilePointsHistory.tsx"

target = "customer-account.profile.block.render"

default_placement = "PROFILE2"

When I try to add both targets, I get this error:


Duplicate targets found: customer-account.profile.block.render 
Extension point targets must be unique

Is it not possible to have two modules render at different placements on the same page using the same extension point? If not, what’s the correct way to do this?

2. Placement doesn’t seem to work when testing

Even with just one module, trying to use default_placement = "PROFILE1" doesn’t place it correctly. According to the docs here:

https://shopify.dev/docs/apps/build/customer-accounts/inline-extensions/build-profile?extension=react

“To test this, you can add the `?placement-reference=PROFILE1` query parameter to the URL…”

I tried that, but it didn’t help, the extension still renders before the heading. The docs also mention:

“…blocks are placed in the first available placement reference by default.”

And that placement is usually set via the checkout editor in production. But then in this doc:

https://shopify.dev/docs/apps/build/app-extensions/configure-app-extensions#customer-account-ui-extensions

implies we can set placement via code.

What I’m trying to do

I just want to render two different components on the same profile page, in two different locations (e.g., PROFILE1 and PROFILE2), set via code/config, exactly like what’s shown in this image from the Shopify docs:

Any guidance or examples would be super helpful. Thanks!

I think the new guidance is to make an extension per target.

Could you try organizing your code like this?

In extensions/profile-points-description/shopify.extension.toml

[[extensions.targeting]]

module = "./src/components/ProfilePointsDescription.tsx"

target = "customer-account.profile.block.render"

default_placement = "PROFILE1"

In a separate extensions/profile-points-history/shopify-extension.toml

[[extensions.targeting]]

module = "./src/components/ProfilePointsHistory.tsx"

target = "customer-account.profile.block.render"

default_placement = "PROFILE2"
2 Likes

In my current shopify.extension.toml file, I have the following configuration (removed the second module):

[[extensions.targeting]]
module = "./src/components/ProfilePointsDescription.tsx"
target = "customer-account.profile.block.render"
default_placement = "PROFILE1"

Based on the documentation (see Shopify Docs - Extension Placement), this should render the component in the PROFILE1 section of the profile page, as also shown in the image I included in my post. However, it’s not appearing there as expected.

Additionally, the testing setup using the query parameter ?placement-reference={name} (outlined here) doesn’t seem to work either. What do you think could be the issue here?

Thank you for the response!

Personally I have never had any luck getting default placement to work, either in the extension toml or the query param like the documentation outlines.

But it sounds like the Extension point targets must be unique problem is solved by splitting the extension into two?

1 Like

Alright, using two separate extensions resolved the issue with multiple modules on the same page, but the placement preference is still not working. Is it only something the merchant can edit through the checkout editor in their store settings?

Thanks for your help regardless!

Sure thing, happy to help.

It might be best to start a new topic about this separate issue. That way it’s easier to search for by others with the same problem.

1 Like