[Bug] Cart attributes are not passed to functions when "Buy it Now" button is used

I am using cart attributes to pass a customer specific ID from my theme UI extension to my checkout UI extension in order to track user journey in relation to my app being seen/interacted with. When I’ve added my attributes and the add to cart and checkout buttons are used, no problem. When the Buy Now button is used, there seems to be a fresh cart created, not including the attributes that I’ve added. Is there any solution to this or workaround for it?

This is a near duplicate of an unsolved post from the older Shopify community forums: [Bug] Cart attributes are not passed to functions when "Buy it Now" button is used - Shopify Community

1 Like

You could have the accelerated checkout button in a separate form with a return_to hidden input that goes to /checkout I believe. I do not believe I have ever tried that but I know adding products to cart via URL allows for a &return_to= to be used so I am assuming it should work with the product form too.

You would not display the third-party accelerated checkout buttons in that case but I believe it should retain the attributes.

That could work, but would require every merchant who installs my app to alter their form either in the theme editor or in liquid, wouldn’t it? That won’t work well for me…

No, you just need to inject the necessary HTML into the form if it is not already there, a simple solution as long as the customers have JavaScript enabled.

1 Like