We recently transitioned our custom app into a public app on Shopify. Although the new storefrontAccessToken retains the same access_scopes as our previous custom app, we're encountering an issue: our headless mobile app, which utilizes the Storefront API, is not functioning correctly with Shopify's LineItem Script during checkout processes. Intriguingly, when we revert to the 'old' storefrontAccessToken from our custom app, everything works as expected. Are there any specific settings or steps we need to follow to ensure LineItem Scripts operate correctly with a public app?
LineItem Scripts are server-side scripts that run during checkout to change the properties of line items. If these scripts are not functioning correctly, it might be due to compatibility issues with the new public app setup. Check if the scripts are specifically tied to any app credentials or configurations that were part of your custom app setup. Also, changing from a custom to a public app can sometimes alter the way API calls need to be structured.
Are you seeing logs for any errors or warnings that occur during the checkout process?
I have tried this minimal script which should definitely work and has no dependencies:
# Define the discount rate
DISCOUNT_RATE = 0.10
# Apply the discount to each line item
Input.cart.line_items.each do |line_item|
# Calculate the discount for the current line item
discount = line_item.line_price * DISCOUNT_RATE
# Apply the discount
line_item.change_line_price(line_item.line_price - discount, message: "10% off everything")
Output.cart = Input.cart
This line item script works for the custom app (old storefrontAccessToken) but not with our new public app (new storefrontAccessToken). Everything remains the same. We haven't touched any logic on our side. By that I mean it's the same mobile app, same builds etc. Only the storefrontAccessToken was updated due to transition to public app. I have re-published the script several times.
EDIT: No logs or anything related to this in checkout.