Debugging in shopify function

Hi team,

We are implementing delivery customization - function, seems we don’t know how/where to see the console or how to debug it? could you help us? thank you very much

1 Like

Hi there :waving_hand:

If you would like to have logging inside your Shopify Function in javascript you will need to use console.error(“your message”);

if (!targets.length) {
      // You can use STDERR for debug logs in your function
      console.error("No cart lines qualify for volume discount.");
      return EMPTY_DISCOUNT;
    }

To view the output you will view the extension runs inside your Shopify Partner Dashboard, they can be found Your App > Extensions > Your Function Name > See Details of a specific run of the function.

In the Logs (STDERR) section you should see your error logging.

You can review the documentation for more information on debugging.

2 Likes

Thank you very much for the support

Hi @lizk could you tell me how to make the See Details button appear? (lots of error don’t have this button) and how to log error with data variable like

console.error(“deliveryGroups”, deliveryGroups);

Thank you very much.

I am still unable to see the logs in payment function. Refer to the screenshots attached.

Do you found solution with “See details” button?

do a
npm run build
npm run deploy

and now check , it should work!