Post purchase shouldRender not working

Post purchase shouldRender not working

fullmetal
Shopify Partner
13 0 2

Hi, I've developed a post purchase checkout extension that makes a call to the backend of the app to determine whether or not shouldRender should render. It works fine locally but doesn't work in production. 

 

It seems like sometimes the API endpoint will be called and sometimes it will not. 

 

In either case, the shouldRender return does not seem to work at all. I've tried removing the API call and directly calling:

 

return { render: true }

 

 but even this does not work. 

 

Here's the code I'm working with. Am I missing something about the admin settings or something?

 

 

extend("Checkout::PostPurchase::ShouldRender", async ({ inputData, storage }) => {

    let shouldRender = false
        
    let bundles = await getRenderData(inputData).then( bundlesArr => bundlesArr )

    if ( bundles.length ) {
        shouldRender = true
        await storage.update({ bundles, orderTime: Date.now() });
    }

    return { render: shouldRender };
});

I was able to verify that the bundles variable is being populated with an array of objects, and like I said, it does work locally. Any help would be very much appreciated!

 

Replies 4 (4)

lizk
Shopify Staff
246 58 78

I would recommend reviewing the limitations for post-purchase extensions. Certain payment gateways, cart totals and multi currency orders will all stop the post-purchase extension from rendering.

To learn more visit the Shopify Help Center or the Community Blog.

fullmetal
Shopify Partner
13 0 2

None of these issues seem to relate to the post purchase page not displaying. Even if we directly return 

{ render: true }

like:

 

 

extend("Checkout::PostPurchase::ShouldRender", async ({ inputData, storage }) => {
    return { render: true };
})

 

it still does not show. Are you able to look at the specific store the app is installed on in order to determine if something else may be wrong on Shopify's end?

lizk
Shopify Staff
246 58 78

If an order is a multicurrency order or any of the above limitations then the post purchase page will not render. It will not execute the code. {render: true} would not be executed. 

Can you also confirm that you have turned on the post-purchase page on your new store? This is done in the admin in settings > Checkout > Post-purchase page.

To learn more visit the Shopify Help Center or the Community Blog.

fullmetal
Shopify Partner
13 0 2
Yes, it has been turned on in the admin settings. Can you look at the backend of the store to confirm that there isn’t an issue from Shopify’s end?