Add to cart button redirects to cart page and changes web page design

Hello,

I wanted to know how to add correctly the “Add to cart button” for every product without changing the design of the page, when I add the button using the following code:

It adds the button but messes up the design and it also redirects to the cart page instead of just adding directly the products to the cart.

Anyone knows how to fix this problem?

Thanks!

Add this inside your form to stay in the same page when adding to cart:


So the final code for your from would be:


If you would like the add to cart without page reload the you would have to Ajaxify your cart

About the add to cart button messing up your design, solution for that depends in the theme you are using. Can you share and URL where you have added this form?

If my post has helped you, please Like. If my post solved your issue, please mark as Accepted.

1 Like

The redirect problem was solved! Thanks a lot!

About the design problem the URL is: https://mx-comp-store.myshopify.com/

I do not know what I need to change for the add to cart button to not mess my design.

Your site is protected by user/pass so I cannot see the add to cart button to propose a solution

You are right sorry, let me share screenshots:

It looks like this with the button added:

And without the button it looks like this:

So i would like the same design and just the button next to the price for example.

I would need to access your store to propose fix, it is not possible to check what is wrong via screenshots. You can send login credentials via PM or I could request collaborator access.

How can I send you a PM, I can not find the option to do it in your profile.

I got to show the quantity and add to cart.

How can I make the circle item in center..

The price, product, title and the quantity in the box?

For the quantity in the box it is like full width how can I edit that box?