Menu icon
RedCrackle
Menu icon
Services
01Design Transformation
About UsCase StudiesBlogContact Us

<

Blog post

Adding a Shopping Cart

Neerav Mehta

Founder & CEO

This is tutorial #5 in the Drupal Commerce tutorial series. In the previous article, we showed you how to manage product inventory.

In this article, we will show you the basics steps involved in displaying a cart for your Drupal store. Here is a screenshot of one of the final screens in which the cart is displayed via a block:

Adding a Shopping Cart

Clicking “View cart” in the above screen takes you to the following screen where you can add or remove products from your cart in real-time:

Adding a Shopping Cart

To get started, you will have to download, unzip and enable a contributed module known as “Commerce Cart Ajax”. This module ensures that the shopping cart block is loaded using AJAX. This facilitates the caching of the rest of the page. In short, your shopping cart page's loading performance is improved.

Type https://www.drupal.org/project/dc_cart_ajax on your browser window tp unzip the required module.

Once you are on the page, scroll down to view the tar.gz file you wish to download.

Adding a Shopping Cart

After you have unzipped the file, it’s time to enable “Commerce Cart Ajax”.

Click “Modules” in the top-level menu:

Adding a Shopping Cart

Search for “Commerce Cart Ajax” and enable it.

Adding a Shopping Cart

Click “Save Configuration”.

Adding a Shopping Cart

Let’s now enable the cart to be displayed on the homepage. This is how the homepage looks at the moment:

Adding a Shopping Cart

We will display the cart in the form of a box on the left side just above the search box.

For this, click “Structure” on the top-level menu. And click “Blocks”.

Adding a Shopping Cart

Search for “Shopping cart” under Disabled. Select “Sidebar first” from the REGION dropdown.

Adding a Shopping Cart

“Shopping cart” will now be displayed under the Sidebar first section as shown below:

Adding a Shopping Cart

Drag “Shopping cart” to above “Search form” by using the icon on its left.

Adding a Shopping Cart

Click “Save blocks” at the bottom of the page.

Adding a Shopping Cart

Go to the homepage. This is how the cart will be displayed:

Adding a Shopping Cart

You can have the cart displayed anywhere on the page by specifying a location of your choice for the block. Click “View cart” and you will be taken to the following screen:

Adding a Shopping Cart

You have now activated the display for your site’s basic shopping cart functionality.

You can also activate AJAX functionality for your site. This will further enhance product updation and deletion processes from the cart.

Click “Edit view” as shown below in both summary and detailed shopping carts.

Adding a Shopping Cart

In the new screen, expand “Advanced”. A set of options will now appear. Update the No value for “Use AJAX” with Yes.

Adding a Shopping Cart

Click No and a pop-up appears.

Adding a Shopping Cart

Select Yes and click “Apply”. This will ensure your site is more adaptable to AJAX functionality.

I am going to update the quantity for the 1st product. I will choose 10 items instead of 3. Click “Update cart”.

Adding a Shopping Cart

Notice how the cart has been updated after increase in quality.

Adding a Shopping Cart

Play around with the functionality of your cart to get accustomed to it. Add, remove or update products to strengthen your basic understanding of its functionality. You will need to have a good understanding of CSS to make further visual additions to your store.

Next: Configuring the checkout process

Neerav Mehta

Neerav Mehta

Founder & CEO

Neerav Mehta is the Founder & CEO of Red Crackle. With sterling qualities, Neerav’s technological acumen is firing a generation of progressive companies on the digital path. With an undergraduate degree in Electrical Engineering from India's most prestigious institution IIT Bombay and having spent seven years developing and contributing to the launch of AMD's innovative line of computer products, Neerav founded Red Crackle where he is lauded for his dynamic and innovative genius.

View all posts

>

Read Next

10 Tips For Entrepreneurs In 2015

10 Tips For Entrepreneurs In 2015

Learn more

10 Ways To Increase Productivity At Work

10 Ways To Increase Productivity At Work

Learn more

30 best WordPress widgets for your site

30 best WordPress widgets for your site

Learn more

Let’s get you started!

Contact Us

>

RedCrackle

Explore

About Us

Services

Contact Us

Our address

5346 Gerine Blossom Dr,

San Jose, CA 95123

USA

Socials

Twitter
LinkedIn

© 2023 RedCrackle. All rights reserved.