What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: Delivery customization extension - function doesn't run on merchant's store

Delivery customization extension - function doesn't run on merchant's store

julia-kwiecien
Shopify Partner
2 0 0

We are implementing a delivery customization extension, but the function doesn’t seem to run at all.
The extension is working as expected if the app is installed on one of our development stores. It doesn't work if it is installed on the merchant's store.
The app is configured to be used by one store only. We also have a checkout UI extension that is working as expected.
The extension is available in the “Extensions” tab. UI components in the admin panel are available and work as expected. We are able to manage customizations from the admin panel. But then, we can see no effect in the checkout. Also, the extension’s page in the partners portal shows no function runs, so it’s impossible to debug it.
Is there some additional step we should take to make it work? Has someone encountered such an issue?

I will be grateful for any help.

Replies 10 (10)

MosheBOA
Shopify Partner
1 0 0

I'm having the same problem. Couldn't figure it out yet

 

hsdonkin
Shopify Partner
19 1 8

I had this issue when I was creating an extension-only custom app for delivery customization -- and I solved it!!

Basically, when you create an extension, you're declaring a function like you would in JavaScript. But just like in JS, declaring a function doesn't run it. The function needs to be called somewhere.

 

There's a separate mutation that needs to be run to create a DeliveryCustomization, which calls the function.

https://shopify.dev/docs/apps/checkout/delivery-shipping/delivery-customizations/getting-started#ste...

You can add and view delivery customizations under Settings > Shipping and delivery.
https://help.shopify.com/en/manual/checkout-settings/checkout-customization#add-shipping-customizati...

What was kind of weird is that since I have an extension-only custom app, I can select it to add a customization, but it just redirects me to the info page for my custom app, since it has no frontend.

Now after running that mutation to create a DeliveryCustomization, I'm seeing my function runs appear in the partner dashboard.

joppx25
Shopify Partner
4 0 0

Hi Hsdonkin, 

Just want to ask a question if the shop is required to install a graphql app also to enable this customization? I have the same case you have right now, in which I don't have a UI only extension-app but I'm kinda confused why when I select the delivery customization inside Shipping and delivery section it didn't work. 

hsdonkin
Shopify Partner
19 1 8

Since I posted that, Shopify seems like they pushed an update to allow you to create instances of Delivery Customizations via the dashboard, so basically what I did with the GraphQL app, but with a UI instead.

 

So to answer your question, the GraphQL app is not required, since the dashboard lets you do it now with a button.

 

If things aren't working after you created an instance of a delivery customization, and you can see successful function runs in the app extension logs, I would look at writing errors to STDERR, because could surface errors in your customization script.

RobertCo
Shopify Partner
36 2 14

We're also experiencing this issue. When you say create instances of the Delivery Customizations via the dashboard - where abouts can you do this? Struggling to see anything here.

Jude_Huang
Shopify Partner
8 0 2

This is a little bit strange. The GraphQL query function only works when npm run dev is running. So it can work for my dev store.  But in the production environment, the graphql query returns no customization functions, so I can't the ID to run the mutation function. Has any one experience the same issue?

 

I also don't see the Shopify's update to allow me to create a Delivery Customization instance on the dashboard. Where do you see that?

 

Thanks!

hsdonkin
Shopify Partner
19 1 8

Yeah to troubleshoot this, I would check:

  • Is the app installed on your production store, with a version deployed that uses your delivery customization extension? Dev stores can view work in progress versions of functions, and so you need to deploy a new version for production stores.
  • Are you querying `functions { }` with an API token generated by your app's client ID and client secret? Interestingly the GraphQL app can see functions installed by all apps, so you can run the `deliveryCustomizationCreateMutation` using it, but only your app can see your app's functions, so you can't run it with any old Admin API token. The query returns null when using other authorization.

The dashboard method is via Settings > Shipping & Delivery, in the "Delivery Customizations" setting.

hsdonkin_0-1698077053658.png

 

julia-kwiecien
Shopify Partner
2 0 0

Thanks! We had this added, our issue was different and quite silly to be honest... We had function code wrapped in try catch and we had some errors (data was different than what we expected). Anyway, with try/catch and console logged errors, there was no trace of function runs in partner's portal. After removing try/catch, we could see that function is, in fact, running and what the error is. 

hsdonkin
Shopify Partner
19 1 8

Great! Yeah one thing that tripped me up as well with trycatch -- `console.log()` prints to STDOUT, whereas with errors you need to print to STDERR which is `console.error()`.

So if you're printing to STDOUT you're basically silencing the errors!

GetAllTool
Shopify Partner
36 0 7

One of my customers uses my app, and today the delivery customization function suddenly didn't work, I tested the checkout in his store, but I can't see the execution log in the Shopify Partner admin, I checked the customer through the API (deliveryCustomizations), the status is active, there is no problem, it just doesn't work, I don't know what to do, has anyone encountered the same problem with me?

 

The Shopify function is a black box, so it's hard to figure out what to expect!