Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Usually when I wanted to show the purchasing process in this course, I just stayed logged in as the administrator, just because that's the fastest way. But there were a few times I did switch over to another browser, and show you what the process looks like to someone who's not logged in to the site. On completing the first order by a casual visitor, the store creates a customer profile for that person based on the e-mail address. That's so they can go back, log in under the new account name, and do such things as review the order. This video shows you a little more about how Drupal Commerce creates and manages customer profiles.
We'll start by looking at the obvious stuff. Go up to Store, and Customer profiles. You'll notice that for each order, there is a Shipping information, and a Billing information, and that these profile IDs aren't related to users, or orders, or anything like that; they are their own thing. However, each one of these profiles is linked to a user. In this case, the admin for most of them, and then there's that one time when I ordered from somebody who was just visiting the site. That can be a little confusing, but the way I think about it is this. A user is a person, the customer profile is two snapshots of that person at the moment that he or she placed the order.
We'll talk more about users, and how they relate to customer profiles, in just a minute. Now, if we go in to edit any one of these customer profiles, we get a warning up here saying that the profile is referenced by an order. So if you change any field values, it'll actually create a clone. That relates back to what I was saying about this being a snapshot at a moment in time, but let's take a look at the orders instead. Go up to Store, and Orders. If we go in and edit the Shipping address, lets say, for any one of these orders, we can do that, and it's just fine.
Scroll down, and we see the Billing Information. This is one that we did before we had the Shipping module installed. If we make the changes here, it's okay, because it's not changing that snapshot of the user at that moment in time. The lesson here is to edit the address where it makes sense. If it's just to change the address on a single order, change it on the order itself. But anyway, let's get back to customer profiles. Go up to Store, and Customer profiles. Customer profiles are entities, just like nodes and products. We talked a little bit about entities in the video, Understanding products and other entities, but customers are a little different.
Because they're so central to Drupal Commerce's functioning, your control over what you can do with them is a little more constrained. However, like other entities, each customer profile is based on a template of sorts, which you see here under Profile Types. One thing you'll notice is you can't add a Profile Type. There is no link up here that says add, like there is for some kinds of entities. However, you can manage fields, and manage their display. The only thing that's in here by default is Address, but if you wanted, you could add something saying, for example, you must put in your age, or something else like that; any other information that you want to collect at the time that you collect billing information.
Let's take a look at that Address form. There are quite a lot of options on this page that are specific to addresses. For example, you could limit the countries that are available on this form. Since, we have none selected, that means that people can order from any country. You could add a default value, which by default, interestingly, is the United States, but you could remove that if you wanted, and then there's a few other things. We'll just leave it as it. So we've looked at Orders, and Customer profiles, but you might be asking, how does this relate to the people who are logged in to your site; your site's users? Well, the way we'll look at that is, once again, we'll look at our Customer profiles, and we see this User column.
Let's take a look at this one: firstname.lastname@example.org. If we click it, we can go in and edit all sorts of things here; the password that they use to log in. If they turn out to be a problem customer, we can block them. That will not block them from buying, but it will block them from taking part in the site. We could also give them additional permissions. If, for example, we've known them for years, and they've turned into a good customer, and we want to increase the level of involvement they're allowed to have in the site. As we scroll up to the top, we can also look at the orders that they've placed, and we can click through and look at all the details of the order.
Now, if you're an experienced Drupal user, a lot of this part is old hat. Stores built in Drupal Commerce leverage Drupal's built-in user system. That's really good, because it means that you can integrate store activity with site activity really well. For example, you could create a site where people get credits for performing certain online tasks, and then buy things from the store using those credits, instead of money. Or you could do it the other way around; when somebody buys something, they get leveled up, for example, on the site. You could build a view to look at all of the users, or all customer profiles; all of this stuff in the normal way you do in Drupal, but those are advanced topics.
The important thing to know as you launch your store is that your customers are protected by the same high-security system that's in use on over a million Drupal Web sites
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98268 Viewers
80 Video lessons · 141407 Viewers
59 Video lessons · 59771 Viewers
52 Video lessons · 72980 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.