Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Hello everyone,
I have been having some issues with shopify functions. I am currently using the cart transform "purchase.cart-transform.run".
I tested it in a dev store and my function gets triggered every time the cart is changed, but I installed it in my live store and the function is never getting triggered. I reverted all my code and put it in the simplest possible manner, so just applying a price of 100 to every item in the cart.
// @ts-check /** * @typedef {import("../generated/api").RunInput} RunInput * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult */ /** * @type {FunctionRunResult} */ const NO_CHANGES = { operations: [], }; /** * @param {RunInput} input * @returns {FunctionRunResult} */ export function run(input) { console.error("Running cart..."); console.error(JSON.stringify(input)); const updates = input.cart.lines.map((line) => { return { update: { cartLineId: line.id, title: "This was updated", price: { adjustment: { fixedPricePerUnit: { amount: 100 } } } } } }).filter(value => value); return { operations: updates, }; }
I would like to know why this is not being triggered at all on one store, and always working on the other.
Did you activate the transform via GraphQL? Do you see any function runs at all in the Partners Dashboard?
If it's activated but you don't see any runs at all, I would contact merchant support for the store.
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog