How to add a " Buy" and " Add to cart " links under products on homepage?

Hello all,

I want to add a " Buy " and " Add to cart " links under products on homepage, which " Buy " link redirects to checkout page and " Add to cart " link redirects to cart popup notification. The links have to be shown on mobile and descktop as well.

Store URL: https://u7yeji-na.myshopify.com

Here’s a concise expert response:


To add “Buy” and “Add to Cart” links under homepage products on your Shopify store:

  1. Edit your theme files:
    Go to Online Store > Themes > Edit code, then open sections/featured-product.liquid or sections/featured-collection.liquid (depending on where the homepage products are rendered).

  2. Insert buttons below each product:

Buy

Add to Cart

  1. Enable cart popup:
    Ensure the cart drawer or notification is enabled in your theme settings, or trigger it manually via JavaScript after the Shopify.addItem() call.

  2. Optional: For cleaner UX, style the buttons using your theme’s existing CSS classes.

Let me know if you’d like help with exact code placement or styling.

Hi @Mamdouh_USD

We can add the “Buy” and “Add to Cart” links under each product on the homepage. The “Buy” link will redirect users directly to the checkout page, and the “Add to Cart” link will trigger the cart popup notification as required. Both links will be visible on mobile and desktop.

Thanks

Hello @Mamdouh_USD ,

Please check the theme settings and theme documentation if the feature is available within the theme then you can use it.

Alternatively you have to go with a developer to implement it.

Regards
Guleria

Hi,

Hope this will help

  • Find Homepage Product Section
  • Locate Product Loop
  • Paste This Code for Buttons

Code example


  
    Add to Cart
  

  
    Buy Now
  

  • Use CSS for style
  • If You are Using Dawn theme , Make Sure Cart Drawer is Enabled. If not, use JavaScript

Hi @Small_Task_Help , can you please guide me step by step where to paste the code? and what do you mean by saying “Make Sure Cart Drawer is Enabled”?

Please tell me with images please. thank you