Click add to cart url, but stay on page?
-
This is related to my request at:
https://www.ads-software.com/support/topic/custom-post-add-to-cart-buttons-editing/
which was marked resolved, but was not resolved at all.
So doing the add to cart url with ID, I made a link like:
https://yourgroovydomain.com/?add-to-cart=123
And it of course loads the item in the cart. But the problem is that the site thinks that “?add-to-cart=123” is a page and tries to go there, and since there is no such page, it just goes to the home page. I was using a 404 to homepage plugin so I disabled it, but it still just goes to the home page.
Is there a way to click this link and keep the user on the page that it was clicked on?
I actually found that it will go back to or “stay” on the page if I do:
https://yourgroovydomain.com/this-page/?add-to-cart=123
But one problem with this is that if the user hits the back button (for whatever reason) the item gets loaded in the cart again. While this isn’t bad, it’s just not ideal.
Some kind of a combination that would go like this would be great:
https://yourgroovydomain.com/?add-to-cart=123 —> https://yourgroovydomain.com/this-page/
But then in either of the last two examples, I don’t know in advance what the name of the page is for the /this-page/ part, because it gets automatically created when importing products from our database. So I would need something that effectively does this:
get-current-url/?add-to-cart=123
I know this is a lot, but it seems like the last thing I can try.
Thanks!
- The topic ‘Click add to cart url, but stay on page?’ is closed to new replies.