New Shopify Certification now available: Liquid Storefronts for Theme Developers

Debugging in shopify function

Solved
hoannguyen02
Shopify Partner
15 1 1

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

hoannguyen02_0-1692620477323.png

 

Accepted Solution (1)
lizk
Shopify Staff
Shopify Staff
246 57 62

This is an accepted solution.

Hi there 👋

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.

Shopify Partners 2023-08-22 12-08-49.png

You can review the documentation for more information on debugging.

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

View solution in original post

Replies 5 (5)
lizk
Shopify Staff
Shopify Staff
246 57 62

This is an accepted solution.

Hi there 👋

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.

Shopify Partners 2023-08-22 12-08-49.png

You can review the documentation for more information on debugging.

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

hoannguyen02
Shopify Partner
15 1 1

Thank you very much for the support

hoannguyen02
Shopify Partner
15 1 1

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);
 

hoannguyen02_0-1692869639345.png

Thank you very much.

sebastiandev
Shopify Partner
43 1 12

Do you found solution with "See details" button?

sameed123
Shopify Partner
1 0 0

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

sameed123_0-1698784171256.png

sameed123_1-1698784260679.png

sameed123_2-1698784326884.png