Hello, Can you please tell me how and where to add code and please share code for add to cart through product page. Thank you
Topic summary
Goal: add true “Add to cart” buttons in multiple spots on a product page (Be Yours theme) so shoppers can keep scrolling instead of a “Shop now” anchor that jumps to the top.
Proposed approach: avoid creating separate add-to-cart logic. Instead, style extra buttons with the theme’s button classes (e.g., product-form__submit, button, button–full-width) and use a simple script to programmatically click the page’s original add-to-cart button. Note: hardcoding {{ product.variants.first.id }} won’t reflect option changes (size/color).
Outcome: the indirect “click the original button” method worked for the original poster.
Caveats: may fail or behave oddly if the page has multiple products/forms (e.g., quick view/quick buy in recommended products). The query selector should be specific to the correct form/button (not any element with name=“add”).
Follow-ups: two participants asked how/where to add the code and for help applying it to their own product page so all buttons add to cart; one shared a product URL. These requests remain unanswered in the thread.
Status: partially resolved (original poster). Additional implementation guidance for others is still open.