Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Merge operation in Cart Transform Function not working even though the function's output is cor

Merge operation in Cart Transform Function not working even though the function's output is correct

Tek-Labs
Shopify Partner
4 0 0

We want to merge 2 products in the cart into one product, using Merge operation of the Shopify Function.

The function's output is correct:

image.png

but in the cart and checkout, the products are not merged

TekLabs_0-1702614075729.png

can someone explain why ?

 
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
Replies 9 (9)

Liam
Community Manager
3108 344 899

Hi Tek-labs,

 

From looking at your output it does seem to closely match the format of the example, however you don't have values for the title and image properties. It's not 100% clear if these are required, but can you try adding these and testing again?

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

Tek-Labs
Shopify Partner
4 0 0

Thank you for your feedback; I'll give it a try. However, there's another issue. I have a test site with the logic function working exactly like the logic function mentioned above, and it's functioning normally. But on the live and dev sites, it's not working. Could the issue be related to my store?

This is the output from my test site, and it also lacks a title and image

Screen Shot 2023-12-17 at 00.35.16.png

My live site is: https://demo-salepify.myshopify.com

And my test site is: https://test-function-toolkit.myshopify.com

 
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
Tek-Labs
Shopify Partner
4 0 0

I tried adding the title and image in the merge, but the function still doesn't work.

Then i installed the app on another store, and it works fine there. I've searched the documentation, but it seems there's no documentation addressing this issue.

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
Liam
Community Manager
3108 344 899

Hi Tek-Labs,

 

It's possible there could have been some browser caching at work which didn't reload the new configuration? Glad it's working on another store though - I'll pass your feedback on documentation to our internal team.

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

geobertz
Shopify Partner
27 0 22

Hi,

Try to check if there are any errors on your Partners Dashboard > Apps > Click your app > Extensions > click the function > see details and check Logs (STDERR).

There should be an error that explains the issue if any.

geobertz
bbalmer
Shopify Partner
4 0 0

Have you run this on your live site to enable the function?

mutation.graphql

Copy
mutation {
  	cartTransformCreate(
    	functionId: "YOUR_FUNCTION_ID_HERE",
    	blockOnFailure: false # Determines if function failures should block buyers from checking out
  	) {
    	cartTransform {
      	id
      	functionId
    	}
    	userErrors {
      	field
      	message
    	}
  	}
}

midavis
Shopify Partner
9 0 0

I just had this same issue and it was because my "bundle container" product was not active.  This really sucks because it now shows inside of my store as Out of Stock and I don't want it showing up at all.

nrthbound
Shopify Partner
5 0 3

Yeah. This is really annoying. They expect you to build the "Bundle Container" product dynamically and then attach your bundled products to it. This documentation for Checkout Extensibility, and the new Shopify Functions are a total nightmare. They had 1000's of great examples to model their documentation off of and they just made something up that makes no sense. They don't even tell you how to change the title or the price of the bundle dynamically.

fjsolutions
Shopify Partner
2 0 0

Hi there, it happened to me several times. Try uninstalling any other apps that also uses the merge operation