- Posts: 48
- Thank you received: 4
Add to cart without Ajax and redirect user to checkout
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4
-- Browser(s) name and version -- : Any
-- Error-message(debug-mod must be tuned on) -- : None
Hi
Is it possible to add a product into cart without using Ajax and redirect the user to checkout rigth after?
Thanks.
Please Log in or Create an account to join the conversation.
Yes. In fact, if you block the javascript on the page and click on the add to cart button, it will do exactly that as a fallback to the AJAX add to cart.
Note thought that even with the AJAX add to cart, you can redirect to the checkout with the settings of the HikaShop cart notification plugin in the Joomla plugins manager.
When you edit a product in the backend, you can see the button "add to cart HTML button". If you click on it, it will open a popup where you can get the HTML for an add to cart button without javascript which works like you want. You can copy that HTML anywhere on your website or even on another website and it will work.
Please Log in or Create an account to join the conversation.
nicolas wrote: When you edit a product in the backend, you can see the button "add to cart HTML button". If you click on it, it will open a popup where you can get the HTML for an add to cart button without javascript which works like you want. You can copy that HTML anywhere on your website or even on another website and it will work.
Hi and thanks for this.
This would mean to add such button manually to each product. There are many products... I'm looking for a solution that works globally.
Any idea?
Please Log in or Create an account to join the conversation.
You could easily turn off the AJAX add to cart with a small view override.
Edit the file product / quantity.php via the menu Display>Views and change the line:
Note that this is for the product details page. If you also have add to cart buttons on listings, you want to do the same modification in the product / add_to_cart_ajax.php view file.
Please Log in or Create an account to join the conversation.
This is exactly what I was looking for. It works perfectly.
Thanks a lot.
Please Log in or Create an account to join the conversation.
I have exactly the same need. I did the override but it seems to come from "layouts / button.php" (display view on front end)
Can't find where to stop ajax....
we are using hika business 4.7.5 with J3.10.12 on PHP 8.0.27
does it change recently ?
Thanks
Grégoire
Please Log in or Create an account to join the conversation.
No, it's still the same.
Note that this change in product / quantity is only on the product details page.
For the products listings, you want to also do the change in product / add_to_cart_ajax so that add to cart buttons on listings also have the modification.
Note that you might need to clear your website cache if you're using caching, in order to see the change.
If that doesn't help, please provide the URL of a page with the situation so that we can look at what is going on there.
Please Log in or Create an account to join the conversation.
I need to go further
Don't consider below
Several years I practice Hika. Sure it should be "obvious" but can't find it...
The site is a dev one to check our ability to bring our prod site from J3/PHP 7.3/ Hika 4.2.2 to a pre-J4 version (php8 uptodate)
So the dev is an upgraded clone of our prod site (which may have "bring" some custom hack/override I may have forgotten).
Here is the page display product :
Our purpose is to send the customer to the checkout directly as soon as he clicks on "add to cart".
Most of our products need to be logged in for that.
It works well "out of the box" when you are connected (if I disable the cart notification plugin)
But if the user is not connected (guest), instead of redirecting to the login page is throws a "cart_id was not returned in addToCart AJAX call" message in the browser console.
Please Log in or Create an account to join the conversation.