Clear URL after add to cart (shortcode)
-
Hello dear people,
I’m looking for help. I have the following issue.
I’m using a shortcode to add the “add to cart” button on a specific page I need.
The shortcode I using is [add_to_cart id=”975″ show_price=”false”]
The action of the button works perfectly and I don’t have any problem with it, the problem is related with the URL. When I press the the button my url change adding the following code to the final of the actual url, looking somehthing like this: https://www.mywebsite.com/products/?add-to-cart=975
This is pretty normal, but the problem is the url remains like this and if the user for any reason refresh the page the product will be added to the cart again.
I realized into the product page where the “add to cart” button is located by default you can experience the same behavior.
Although some people could think this an unnecessary worry or a stupid thing, I would like to know how to change this behavior.
There’s some PHP function I can add to functions.php to chnage this?
Obviously what I want is if the user refresh the page the product isn’t added to the cart again. I checked some famous web shops and the most works like this.
Hope you can help me.
Thank you so much!
- The topic ‘Clear URL after add to cart (shortcode)’ is closed to new replies.