Make user stay on product view after clicking on "Add to Cart" - e-commerce

I'm using Hotcakes Commerce DNN modules and I'd like to know how I can allow the user to stay on the product page after the "Add to Cart" button is clicked. The default behaviour is to redirect the user to the cart page whenever the a product is added to the cart.

The easiest way to make this happen is to modify your viewset to change how the add to cart buttons work. Here's a summary of the required steps:
Add and begin modifying your viewset if you haven't started already.
Modify your \VIEWSETNAME\Views\Products_ProductDetails.cshtml file to change the add to cart action from a post, to an AJAX link. This will allow you to add products to cart directly using a link, but keep you on the page.
If you're using the Mini Cart, refresh the page using JS so that it updates appropriately.
Please note that this option won't work well if your products have choices. If this is the case, you should instead allow your customers to be directed to the cart page, and use a parameter there to determine whether or not you redirect back to the product page.

Related

Add items to a shopping cart with Vue?

I'm trying to figure out how to implement the shopping cart functionality on a page using Vue.js. I get a list of items from an API call and print them on page load. But I'm stuck trying to add items to my cart. The functionality should include the ability to select a quantity of an item and add it to the cart by clicking the "add to cart" button. So it should allow, directly from the cart, to change quantities and remove items from the cart.
For this kind of situation, use a state management pattern like vuex (or pinia), and it will store your data after route change also.
For more clear context, go through this link:
https://vuex.vuejs.org/

How i can add a button on the cart page that will allow the customer to "Empty The Cart". In bigcommerce

How i can add a button on the cart page that will allow the customer to "Empty The Cart". Script will empty contents of the cart.
you could create the button in the template and use a script to call this endpoint: DeleteACart https://developer.bigcommerce.com/api-reference/store-management/carts/cart/deleteacart, to erase an entire cart.
You don't want to use the management api to do this, because that would require authentication. You need to use the storefront cart api I believe.
You would need to call GET /api/storefront/carts and get the id of the cart, and then call DELETE /api/storefront/delete/{id}.
Alternatively you could mimic the native functionality by looping through all the cart items to build a request for POST /remote/v1/cart/update.
The template file for cart in cornerstone is templates/pages/cart.html

PrestaShop Add To Cart button not working from single product page

Whenever the client clicks on the "Add To Cart" button from single product page, it simply goes to cart but cart items are not updated. It redirects to this URL /?controller=cart where all items added either from category view or grid view are there but not the one added from single product page.
I just need a hint on what might be the issue. I'm using Prestashop version 1.7.
Thanks!
It is most likely a JS error; open the browser's dev tools -> console and check the errors, you will notice them they're red.

How to implement "Add To Cart" button in bigcommerce

i am setting up my store on bigcommerce, i want to implement add to cart button on my custom home page can anyone tell me how can i add "Add to cart button" on three blocks below slider(In celebrate, bags, weddings section)? This is my store link http://eveningbags1.mybigcommerce.com/
Usually the best way to make an add to cart button on other pages or from other websites is to take the link the Bigcommerce uses for Category/Brand/Search pages. Works like this
site.com/cart.php?action=add&product_id={product_id}
To add a specific option/sku/variation to the cart, use this format
site.com/cart.php?action=add&sku={sku}
Thanks to #Alyss for the sku info

How to add custom form before "add to cart" page

I am using Magento 1.7. I need to get input from user so how to add custom form for taking input from user.
Let me explain: when click on any product it display product information. Now there should be a button.On click that button it should show custom form. After submit that form it should redirect to "add to cart" page with all the details of that product and values of custom form fields which is filled by user.
Is there any extension or any other way to do this?
On zennioptical.com the "ORDER" button is located on the product listing template
magento template : /app/design/frontend/base/default/template/catalog/product/list.phtml
The prescription form is actually shown on the product detail page
magento template : /app/design/frontend/base/default/template/catalog/product/view.phtml
To accomplish this in magento create a simple product the add custom option for ('Prescription Type' etc) then you will need to do some custom css and javascript to accomplish that layout