Is there any way to add app-block or app-embed-blocks to Thank You Page?

Milind
Shopify Partner
8 0 3

We are trying to build one solution in which we need to display a few details on Order's Thank You Page.

 

[Before Theme App Extensions]
We can do it with ScriptTag to load in order status page.
https://shopify.dev/api/admin-rest/2022-01/resources/scripttag#top
We can use display_scope as the order_status page.

 

[Using Theme App Extensions]
How we can add our app block or app embed blocks to display on Thank you page only?
I am unable to find any documents related to that.

Thank you 🙂 

Replies 5 (5)

axess
Shopify Partner
3 1 0

We had same problem and Shopify confirmed that app embedded blocks can not be added to checkout pages (I suppose Thank You page is considered a checkout page), so just use script tags exclusively for checkout pages and app embedded blocks for everything else. Script tags example:

/* globals Shopify */
(() => {
docReady(() => {
if (Shopify && Shopify.checkout && Shopify.Checkout.step === 'thank_you') {
// DO YOUR STUFF HERE FOR THANK YOU PAGE
}
});

function docReady(fn) {
// see if DOM is already available
if (document.readyState === 'complete' || document.readyState === 'interactive') {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
})();
Chad_Johnson
Shopify Partner
33 1 17

@axess It seems your suggestion is to use an app embed block for all storefront pages except the Thank You page, and then rely on a ScriptTag for the Thank You page.

 

Shopify is telling me with my app that I have to use an app embed block and not use ScriptTag. Will Shopify even allow use of a ScriptTag?

randomdude1
Shopify Partner
5 0 1

@Chad_Johnson what was your final approach? using app embed block for other pages and scripttag for thank you page? did your app get accepted with this approach? 

3Adigit
Shopify Partner
3 0 1

Hi @randomdude1 ,

Were you able to make it work?

Chad_Johnson
Shopify Partner
33 1 17

@randomdude1 @3Adigit Sorry for the delayed response. It seems Shopify's forum software failed to email me about your question.

 

I ended up using a script tag specifically for the Thank You page. When creating a script tag via API, you can set `display_scope` to `order_status`, and, if my memory serves my right, I believe it will execute on the Order Status and Thank You pages.

 

I never submitted my app for review. Based on my vague recollection of my research notes, I think this won't be a problem when submitting your app. If it is, then I would fight back and tell Shopify they need to provide a way to implement app block functionality on the Thank You page.