Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
VanillaCartJS - ES6 JavaScript Shopping Cart
Rating: 4.7 out of 5(238 ratings)
7,485 students

VanillaCartJS - ES6 JavaScript Shopping Cart

Create A Real World Shopping Cart Project And Learn JavaScript ES6 Along The Way
Created byAdrian Bienias
Last updated 7/2018
English
English [Auto],

What you'll learn

  • Writing more bug free code with strict mode
  • Declaring functions including arrow functions
  • Using JavaScript code inside a string with template strings
  • Creating array of objects to store cart items
  • Using forEach and filter array methods
  • Getting elements from the DOM by querySelector and querySelectorAll methods
  • Storing cart items in browser localStorage
  • Adding, removing and getting items from an array
  • Using if statements and inline shorthand
  • Declaring variables using const and let keywords
  • Adding and removing classes in HTML elements
  • Delaying actions with setTimeout function
  • Inserting new HTML code to the DOM
  • Catching click events by addEventListener method
  • Removing elements from the DOM
  • Adding/removing class names and attributes in DOM elements
  • Using following operators: ++, --, +=, ===, !==, ||, >, <
  • Stringifying array to JSON format
  • Code refactoring
  • Submiting HTML forms remotely
  • Using PayPal as a checkout method

Course content

1 section9 lectures2h 34m total length
  • 01 Overview3:04

    Start with a starter front-end project for vanilla cart js, with no back end and product data lives in html (index.html), ready to edit prices and images.

  • 02 Listening for clicks on buttons15:40

    Enable strict mode to catch errors, then listen for clicks on cart buttons using data attributes, querySelector and arrow functions to collect product image, name, and price.

  • 03 Adding products to the cart16:37

    Learn how to add products to a shopping cart with VanillaCartJS, render items using template strings and insertAdjacentHTML, manage a cart array, and prevent duplicates.

  • 04 Increasing quantity18:44

    Learn to implement quantity controls in a vanilla ES6 shopping cart: set initial quantity to 1 and wire increase, decrease, and remove buttons with DOM event listeners.

  • 05 Deacresing quantity and removing items18:16

    Master managing a vanilla cart by decreasing quantities and removing items with safe checks, DOM updates, and CSS animations, including preventing below-one quantities and persisting cart state in local storage.

  • 06 Saving cart to localStorage28:08

    Save the cart to local storage by stringifying the cart array with JSON.stringify under a key, then load it with JSON.parse on startup and update on changes.

  • 07 Refactoring the code16:22

    Refactor the vanilla cart code by extracting repeated blocks into new functions, passing product and cart button elements to improve readability and enable future PayPal checkout and clear cart features.

  • 08 Clearing the cart16:24

    Add a clear cart action and a single cart footer, update the cart array and local storage on item removal, and prepare a PayPal checkout flow.

  • 09 PayPal checkout21:44

    Display the cart total on the PayPal checkout button and build a PayPal form to pass items, amounts, and quantities for checkout.

Requirements

  • Modern web browser and code editor
  • Basic knowledge of JavaScript

Description

If you ever wanted to build a simple but powerful shopping cart with JavaScript this course is definitely for you.

This course it's not about creating ultra king size e-commerce solution. It's about creating real world project with business ready attitude.

All products in this project come directly from HTML code. There's no database or any back-end code. If you want to add new product just copy-paste piece of HTML code.

You will create a project with following features:

  • Adding products to the shopping cart
  • Changing quantity of items in the cart
  • Removing single item or all at once from the cart
  • Placing an order via PayPal checkout

Writing code meant to be exciting and I hope it will be like that in this course. As a matter of fact the shopping cart project is just a cover. The real deal is with this course you should learn programming in JavaScript using ES6 features.

It's worth mentioning that every lecture has it's own source code files. So if you will somehow stuck you can always compare your code with code from particular lecture.

Who this course is for:

  • Beginner web developers who want to master vanilla JavaScript (without using frameworks)
  • Web Developers who want to get more jobs related to JavaScript programming
  • Those who want to create ecommerce features for selling products online
  • Everyone who wants to learn JavaScript ES6 features