Reading list Switch to dark mode

    Add To Cart In Opencart

    Updated 10 January 2017

    Today we will learn about how Opencart adds product to the cart when we click on the “Add To Cart” button. In Opencart there is two process one runs at Search, Category, Manufacturer etc pages and another runs at the particular product page.

    In the Search page Opencart calls a function name “add” to add product to the cart. This “add” function is written in the common.js file. “cart” is a object of having add, update, remove functions.

    After that Opencart makes a Ajax call to the “checkout/cart/add” controller to checks whether the product has required option, if presents then Opencart redirect to that particular product page to choose the required option.

    Searching for an experienced
    Opencart Company ?
    Find out More

    If not then simply adds that product to the cart.

    In particular product page Opencart makes the same Ajax call to check the required function so main difference is that Opencart does not call the “add” function instead of direct calls the “checkout/cart/add” controller. If there product has required option the product does not added to the cart until the required option is chosen.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    6 comments

  • Vivek
    • abhishek oberoi (Moderator)
  • Mujahid Bhoraniya
    • Rahul Gupta (Moderator)
  • Mahendra Choudhary
    • Webkul Support
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home