Unable to view logs from Cart Validation function

Hey brains trust!

I’m experiencing some issues with our Cart Validation function.

The Function has been set up using the Shopify App CLI, and installed on a Plus Partner Sandbox store.

To give some background on what we are trying to do:
Our store has a range of single, one off products, which can be reserved by customers. On a reserved product, the customer’s ID is added to a product metafield.

The Cart validation function check whether the product’s metafield is the same as the customer who is checking out. If not, a message should be displayed.

The issue:
After testing, I am unable to get the message to display when I try and check out logged in as the ‘wrong’ customer. It’s most likely an issue with the logic in the function, but when trying to test, I am not able to get any function logs, so I am not sure if the function is even running.

When running shopify app dev I can see the console output saying the log streaing is not possible due to the Shop being invalid
image

Through the app’s admin screen within the store, I have tried to share the logs using the below menu, but no logs have been sent

I also have tried using the shopify app logs --source extensions.<function_handle> command, but receive the following error

Has anyone else experienced an issue like this?

Are there any configurations that need to be made, either in the extensions.toml file, or somewhere else?

Many thanks.

This is kind of solved. You need to go to the Settings > Checkout menu in the Shopify Admin. There is a menu here where you can manage checkout validations. Select the validation and turn it on.

From here, you can go into the app menu from the store’s admin and then send the function logs to the developer.

After clicking this, you can now view the function runs and any logs within the app dashboard in the Shopify Partners dash.

Still getting the ‘Shop is not valid’ errors in the console. If anyone has any ideas about that I’d love to hear them.

1 Like

Hi Josh,

I’m glad you figured out your primary issue here. As for the Shop is not valid error, this is due to the use of a Plus Sandbox store. Unfortunately Plus Sandbox stores are not supported in app dev (or app logs) for extension development. It’s mentioned here:

You’ve probably noticed that you need to deploy to see changes to your function as well. We’re aware of this limitation and have plans to address it. Sorry for the confusion. Meanwhile if you are able to use a Partner Test store for your use case, these have full support for app dev and app logs.

Nick