I’m not experienced with code in general, but I’ve got a custom page up with custom html to list my products. The products each have buy buttons that call a function with it’s product id.
Problem is I don’t know what to put in the function to add that product to the cart. I tried inspecting the button on the products page but couldn’t figure it out.
Shopify does not recommend the use of Buy Buttons on your Shopify online store or blog, because they can cause problems with the checkout process. Instead, consider using permalinks to pre-load the cart.
Welcome to Shopify Community. My name is Olivia and I work here.
Thanks so much for sharing your question with our network. If I have understood correctly, are you using the Buy Button on a Shopify site? The Buy Button is an amazing solution for external websites that don’t include e-commerce functionality, but they can certainly cause unexpected issues if placed within a Shopify site.
Since a Buy Button is like a shortcut for buying one of your products, I might suggest the use of permalinks as suggested above. If you’re looking to create a custom collection page, that can be done via custom code without using Buy Button embedded products.