 So my name is Gary Thayer. I'm with TenUp. So we're going to be talking about Woo Commerce just to get a sense of the room before we begin. Who here is a business owner who's trying to sell things online using Woo or Shopify or any sort of in-commerce platform? And then people in the room who are maybe developers or agencies or freelancers that are building sites for businesses. Okay, I got a good mix of both but a lot of developers. That's great. So my goals for this talk is to talk about what is some best practices related to Woo Commerce and how to think about using this tool for businesses, whether you're the business owner or the developer. We'll be looking a little bit at some code but not a ton. Mostly what we'll be trying to do is just how to approach a lot of the challenges that e-commerce as a whole can bring and how to install those challenges using tools available to Woo Commerce and WordPress. So anyone who's done this before knows that e-commerce can be hard especially when you compare it to building say a fairly simple portfolio site or maybe a blog. There's a lot of factors that go into creating an online business. This is there are a brick-and-mortar store. So these are just a few examples of things that business owners are thinking about when it comes to merchandising their store. So starting with products, what are you selling? How are you going to present your products as well as an incredibly important part of the shopping experience? You need images that make your products look good. You need descriptions that entice not only customers to buy but also crawlers to index your site so that you can show up in search rankings. What is the pricing strategy? Does this change? Do things go on sale? How do you announce those changes? Maybe you use a lot of coupons but things aren't ever on sale. Inventory management? Maybe you're an antique stealer and you only have one of everything and your website needs to be able to accommodate if it's sold it's gone and take it off the website or maybe you're selling this one widget and you have a warehouse of 10,000 of them and maybe you don't need to worry about inventory in that case. Shipping sizes can be very important because you don't want to overcharge your customers but you also don't want to undercharge your customers. And then an important part of the UI to any e-commerce store is categories and organization. So if I'm selling clothing, am I grouping my clothing by gender and then within that saying pants, shoes, shirts, underwear or alternatively am I grouping things by shirts and then when I look at that I then maybe pick it by gender or maybe it's gender agnostic. So how are you sort of presenting the flow of your website? Moving on to checkout, obviously that's an incredibly important part of any e-commerce store. Customers can't buy anything. You don't make any money. So with checkout what payment processes you're going to use, whether that's PayPal or authorized or Braintree or any of these other services, are you doing coupons? How, you know, sometimes there's these very dynamic conditions that you need the coupons. When someone actually places an order, order fulfillment. How do you know an order was placed? How do you then take the product, put it in a box, put it in the mail and ship it to someone? And then there's additionally maybe third party integrations that go into this as well. So maybe there's a drip campaign. So after someone buys your hair care product, well in a month they might need more of it. So you need to start advertising again in the future. We'll talk about shipping in greater detail later, but shipping costs can be very challenging to work through. And lastly customers. Customers can also be very challenging to work with. But they are at the end of this, the most important part of your story. It doesn't matter what your product is. It doesn't matter what your business is. If you don't have customers, you're not going to make any money. As far as WooCommerce is concerned, this is the easy stuff. This is the stuff that comes with WooCommerce. And I know we've talked of, you know, there's a lot of thought and a lot of energy that goes into everything we discussed. But when you install WooCommerce, you can do most of that right out of the box. I have never met a business that's good enough. Because every business is different. Every business has these unique needs and these challenges that they need to overcome, which is sometimes even hard to put into words. So these are just a few examples of businesses, stories that I've had working with businesses. So my store sells perishable products which need to be shipped and delivered on a specific date. This is not in WooCommerce. In this case, they sell flowers. And the flowers need to be able to be delivered in a way that they don't show up dead and welded and damaged and destroyed. So we need to do overnight shipping for everything. But flowers are generally gifted for holidays and anniversaries. So they need to be delivered on a very specific date, which now means that I need customers to be able to select the state. But if I'm doing a Mother's Day gift, I should also be allowed to buy it in January, not the day before Mother's Day. So or force my customers to do that. So now we need to do some sort of projections and allowing customers to figure all this stuff out. I want to sell products to some of my customers, but not all of them. So this might happen if you have maybe a membership platform, or maybe you're working with post sailors. So in this case, the company sold energy bars. And the standard person can buy packs of one, six and 12. But if you're a wholesaler, you can buy them in packs of 64 and 148 and so on. So there's a whole membership component that you need to sign up and register and get approved. And then after you're approved, you have a whole new suite of products that you can purchase. My business is a store that you can't buy anything. Okay. And so what they meant in this case is that it's basically a gallery. They wanted everything that WooCommerce has they like the architecture of it, the product display. And this was for a manufacturer of flame resistant fabric. And they don't want you to buy these like, you know, 100 foot reams of this fabric. They wanted to get these little swatches. So basically, you're just filling out a contact form at the end, but we use WooCommerce to handle all of the architecture, and the submission of these requests at the end. And then the ad card experience was, there's just no money, basically. So you're ordering. So when all of these things like these are very specific conditions based on every different business, I'm sure a lot of you are thinking my business has this weird rule, or I work with this customer that was very specific on this topic. And I never really understood why. Sometimes you have a development problem that needs to be solved. But a lot of the times in my experience, there's business problems that create development problems. And if you're a business owner, or if you're working with a business, I challenge you, whenever you encounter one of these situations in which you need to create these heavy customizations, to figure out why this is so unique. And maybe that's that's a valid need for the business. But sometimes it's not sometimes you just do things because it's the way you've always done things. And there's not a great reason. And now that you're replatforming, now you have a reason to change your rules. So an example was over to this client who they had four payment sets as part of this like workshop class that they did. And the first class was a $500 deposit. And the next class was a $350 deposit. And then the follow up was a $700 deposit. And then the last payment was $1,000. So okay, well, we've got to bake all these weird conditional rules to handle all these different charges. And the question was actually, why, why is your pricing all over the place? Why don't you just take it divided by four? I don't know, we've done it this way for 15 years. And so instead of spending 20 hours building this customized subscription model to pay it, we could just do it in an hour, using a standard subscription plug in, and it solves everyone's problems overnight. But had we never have asked and just got to work, nobody would have been happy. So so but you are actually going to have to customize things. And we're going to look at a couple ways of doing this. So the most common and simplest method to customize new commerce is by modifying the template files directly. So if you're if you're not aware of this inside of the new commerce plugin, there is a folder set. So if you go plugins, new commerce templates, basically, everything that handles the front end display of your website is set within those folders. What you can do is you can take those files, copy them out of new commerce, and paste them into your theme or your child. And then whatever edits you make inside of that theme will then be reflected on your website. So this can be a very simple way of Okay, I got an image on one side, and I got text on this side, and I just want to switch it. That can be a very fast way of doing this. And if you're not a strong developer, maybe this is your first time popping under the hood. This can be a very straightforward and easy managed way to do this. However, if you've ever been in this boat, you might recognize this screen. And so this was this was one of the sites I was working on where when we commerce went from 2.x to 3.x, they changed a ton of template files, which is great. And that's why we commerce isn't WordPress in general is wonderful is because everything's evolving and changing constantly and getting better. But these theme files are they eventually become out of date because we commerce changes its best practices and it gets better and you got to get better along with it. So in this case, we had very heavily modified a lot of these files. And when this 3.0 update came around, we got all of these error warnings and we had to go into every one of these files and identify what was the original file? What did we change? And what did we commerce change? And then we got to marry all of that stuff into a single update. So my recommendation here is if you can avoid modifying these template files, do that. It's it pays dividends down the line. If you're going to do you're only going to do one or two little minor edits. This is a fine solution. But if you're going buck wild and just adding in a whole new CMS built into these template files, you're going to regret it later. When you do make these edits, very clearly mark the start of your edit, the end of your edit, and the intent of your edit. Because, you know, if you're lucky, we commerce might be doing the thing you want it to now. So you want to know why you've made those changes. If you're making large functional changes, I would recommend doing those changes in a separate file and then linking that file in here, whether you're doing an include or adding your own do action. We'll look at actions and filters in a bit, but if you're not familiar with that, but the benefit there is instead of copying your whole code block, you're just copying this little snippet. And that can be brought into the new new theme file much more easily. And then we talked a little bit about it already. But when it does time come to these updates, you have to look at what was the original version of woo? What is the newer version of woo? What did they change? What was the original version of woo? What is your edited version? What did you change? And then what's the best means of marrying this? Is it better to add WooCommerce's edits to your file? Or should you add your edits to woo's file? So not a lot of fun. There's actions and filters. Is there anyone in this room who's maybe not familiar with actions and filters and how they apply a couple hands up? Very brief crash course. Wordpress has an API that allows for developers to inject pieces of functionality into their processes. And action is just like a little bookmark that says when I hit this process, look for all functions that can get run at this time, run them, keep moving, hit another bookmark, run a bunch of other actions. Filters, content comes in, content gets modified, content comes out. So things get filtered through this process. If you can make changes through the use of actions and filters, I'd highly recommend doing this because actions and filters don't tend to deprecate. They tend to stick around for a while. And Woo commerce will just bring them through every template as they override in the future. This does require a stronger understanding of WordPress development as a whole. And it can be more challenging for entry level developers to start working in this format. But I challenge everyone to take a shot of that. So before I move on, I just want to stop quickly. Does anyone have any questions about stuff we've discussed so far? You can do questions at the end too. But okay, all right, cool. So this is an example of some edits that you might want to make using actions and filters. So in this case, we have okay, so this function add custom checkout field. So in this case, this set is trying to add a custom checkout field that asks for the last four of someone's social security number. Obviously, there's a lot of security concerns that could go into this, but I think it rides a nice little example. So in this case, we write one function which says add custom checkout field. And we're giving it a set of arguments. So in this case, we want a text field. We're going to give it the classic social security field. It's labeled as last four of social and it has a max length of four characters. Make sense so far. And this is a required field. We then run the function WooCommerce form field. And we basically name what is our new field going to date. Here is our action. So inside of WooCommerce, somewhere it says do action WooCommerce before edit notes. So anywhere that any function would get put to this WooCommerce before order notes will then run during this process. So if I could write five or six of these functions, and I'll now have five or six new fields that will show up before the order notes section of my checkout form. This just adds the field. It doesn't do anything with it yet. So in this case, we want to validate it. We want to make sure that someone actually gives me a social security the last four of their social security. So there's another action we're going to run called WooCommerce checkout process. And this, when someone hits that submit button, a whole bunch of functions are run at that point. WooCommerce checkout process is one of them. And that wants to run is SSN valid. So here's the function for is SSN valid. It from the post gets the last four of the SSN checks to make sure that it's actually set. And then if it is set, it double checks to make sure it's actually a number. You don't want letters to show up in a social security number. And if it's not a numeric value, you send back a notice that says it must be a number. Try again. This will prevent payment from being processed. It will prevent any sort of third parties in theory from being triggered. This will just show one of those notices at the top of the screen. Additionally, if the SSN is not set, we want to send a notice that says, hey, you forgot to enter it. Please do that. Now we got to actually save this. So if this is valid, then so we have another action in this process. So WooCommerce checkout checkout update order met up. So this function is run after someone hit submit, after the form has been validated, after payment has been accepted, and after the order has been created in the database. So the process is done. And what we're doing now is we're taking that saved order and we're modifying it so that we can now save this meta value of the social security number to the orders. So in this case, we're again looking for the order. Yeah, we're hooking it to here, we look at the order, and we say if the social is not empty, then we update post meta for the order ID. We call it last four of SSN. And then we sanitize the text field just to make sure there isn't any junk code or cross site scripting or something. Keep it clean in the database. If this is not set, nothing happens, nothing gets saved. In theory, it should always be set because we validated it earlier. But suppression is on that before we move on. Yes. Correct. Yeah, so the question was by validate the validation that we performed is based on, is this a number? We did not go to the Social Security Directory and confirm the identity of the person. That's correct. Yes. In theory, if there was some API where wanting to do that, you could hook it in at that point and say, hey, you're a real US citizen, congratulations, you can buy my product. But but yeah, you're right, we're not validating it in that sense. But we could in theory. So the any other questions before we move on? No. Okay. So what we just talked about was sort of a back end process of when you want these sort of performance based process functions to work. And they all kind of work behind the scenes. Actions and filters can also be applied in the front end context as well. So this is a quick little example of if you were to pop open the WooCommerce single content single product dot PHP, which is the template file, which shows on the product page. You'll see that in the comment, they've notated which functions are currently being hooked to this action. So if you remember, do actions of the bookmarks where functions are fired. And you'll see this number that they've written here, this number identifies the priority. The lower the number, the sooner it happens in the process. So in this case, when WooCommerce single product summary is fired, then first the title displays, then the rating, then the price, then the excerpt, then the ad chart, then the meta, then the sharing, then the product data. And that'll just all get fired and printed out on the page. Now let's say I have a title. And the title was originally at five, but I don't want it to be at the top. I actually want it to be after the meta for whatever reason. So what I can do is I can run a function called remove action. And here I say remove from WooCommerce single product summary, remove the title, when it has a priority of five. So we need to include the same five from up here. And then I recall another function that says add action, which basically re adds this function but changes the priority. So now, without changing any template files, and I can drop this in my functions.php file, I've now moved the title on the product page down to the bottom of the text display. And you could do this to change, you know, maybe I don't want the title to display at all, or I want it to show twice, or, you know, whatever you're trying to do. Questions on that? Yes, that's just a topic. Yeah, so just to repeat it back to everyone heard it, the question was when using WooCommerce, comparatively to Magento, often you'll hear that WooCommerce is better for smaller stores, and Magento is maybe larger for better stores based on the number of products you have in your inventory. Is that a fair compete? And what can you do to handle that? I've heard that as well. I don't think that's an unfair criticism of WooCommerce. I think that kind of stems back to some of the problems with WordPress's database instructor, where everything just gets shoved in the hosts table. I do know that there are ways to better optimize that. I've seen two plugins recently, one of which which moves every shop order into its own database table, and another which moves every product into its own database table. So I haven't used them personally, but I do believe products like that can exist, do exist, and can help in this purchase. I have built a WooCommerce site that had 25,000 SKUs. And from the customer standpoint, it generally didn't make a big difference. However, from an admin standpoint, when you're like, I'm adding a new product, then you get these huge queries. And there's definitely room for improvement there. I don't have Magento experience myself, so I can't speak to how Magento works. But there are ways to better optimize WooCommerce. I hope that answers your question. Moving on. So another way to customize your plugin, or to Woo, customize your store is by using plugins. We were looking at options for writing your own things, but best part about WordPress is a lot of these things are already written for us. There's a lot of really great plugins out there. Personally, I tend to stick to the WooCommerce.com slash plugins. These are all sort of approved by WordPress or by WooCommerce. And there's a lot of great tools on there. Not to say there's anything wrong with anything else, but I just think all of these speak to very high quality. Typically, all of these are written in a manner that reflects best standards within the WordPress and the WooCommerce community. So they include actions and filters and templates that you can override in the same manner we've already discussed. But this isn't your code, too. They didn't write this with your business in mind. They wrote this with a thousand businesses in mind. So it might get you 100% there. It might get you only 80% there. It kind of depends on what your need is. So just a few recommendations that I like out of the box is Woo subscriptions is a really useful one. It's very extendable. So I gave the example earlier of a deposit-based system for this workshop. We were able to do that through a subscription model. It's just a for payment subscription base. We've also used subscriptions. I've used subscriptions for basically making products. You know, it's a $10 product and then you pay $90 down the line for whatever reason. You can do a lot with it. WooCommerce OnePage Checkout is kind of an interesting one. It combines the product page and the checkout page into a single template and that works very well if you're doing like PPC landing pages or newsletters or anything of that nature. So you have one product you're trying to sell. Why go to the product, the cart, the checkout, the thank you page when you can just go to the product and that. URL coupons is kind of interesting. It allows you to set URLs so maybe you're doing like a radio campaign. You can go go to my website dot com slash radio and get 10% off your order. And when someone hits that domain, it will instantly add a 10% off coupon to their cart. So that can be really useful and you can use it for like click here and get 10% off and it just adds some great features. PDF invoices is nice, especially if you need some sort of like packing slip or something that is customer focused instead of just having some kind of ugly template. They're out of the box pretty nice looking and they're pretty editable as well. So this is everybody's favorite topic. So shipping is awful. Yeah, that's a safe word. So we're going to get a couple models for that. But this is a hard one and this is generally one that a lot of people have questions with, even people that have been doing this for years. This is a very common way, especially someone's approaching e-commerce in general for the first time. This is the way they imagine shipping is going to work. Somebody goes to the shop, they order a bunch of products, I hook it up to the UPS API and it automatically knows exactly the dollar amount to be charged in this case because that's how math works. And this is an example of what's called the bin packing problem. So in this case we have nine items and five boxes and in theory if you know the exact size of your boxes and the exact size of your items and the exact weight of your items then these APIs can calculate all this out, go out, request costs, come back and say it'll cost you this much. I'm going to guess most people who are business owners do not know the exact dimensions of every product, let alone the exact packing dimensions of all of their products, do the standardization of the boxes in which all of these things are going to go inside of and then they just kind of wind up tearing their hair out, trying to get this exact perfect answer to the problem. And in my personal opinion it ain't a perfect world and it's often not going to work in this case unless you have the resources to really put a lot of time into this. That's why I try to recommend what's called table rate shipping. Table rate shipping takes a much broader approach to this and instead of dealing with the minutia of a per order basis you have to think of all of your orders in the aggregate. I'm going to make some money here and I'm going to lose some money here but when I look at everything as a whole I want it to come out just about right. Or you might go, I'm going to try and undercut shipping because nobody likes to pay shipping and I'm going to increase the price of my products and it just gives you more flexibility. And then if it doesn't work, change it, keep moving on. You don't have to deal with some third party API and get a developer to try and modify it for you. So in this example of table rate shipping we're using the shipping classes. So anytime you have a product that has a medium shipping class and there's between one and a thousand of them, charge a minimum of $5 and then $3 for every additional product. And then in here we have anything that's small and if we have between 50 and a thousand of them, charge 10 for the order and one free product and down here we have similar rules with small but it defines between 1 and 49. It's a $2 cart plus $1 for every product. I find this a lot easier to work with and you can play with it and you know your mileage will vary. So comparing these two against each other, the bin packing API in theory should be exactly correct every time. The math is done for you and there's plenty of plugins available through UPS, FedEx, Canada Post and wherever you're shipping these things through. And oftentimes they may even include packing labels. You can just slap on the box and some truck comes and you know everything's done for you. Logistics are great. This requires uniform packaging. Not only of the packages that your products actually come in but the boxes that all of your packages are being shipped inside of. So you know if you're Amazon you know most of us have made purchases from Amazon you usually get things in one of three sizes because they have uniformity in their logistics. A lot of small businesses and I've spoken with people that want to use these APIs and they'll say like so what's the size of the boxes that you use? It's just whatever we have lying around. There isn't an API for what you have lying around. We can't guess this. So it's going to be wrong how comfortable you are with this. So additionally you not only so often people and I always use my water bottle as an example. My water bottle is 10 inches tall, I don't know, 10 inches and maybe three inches, four inches wide right? But my water bottle came in a box that was probably an inch taller and an inch wider. And on my website I want to say that it's 10 by 3 but I need to ship it as 12 by 4. The shipping fields in new commerce are intended for, if you're using one of these APIs, these APIs will use those fields for shipping sizes not for actual product dimensions and that's a common mistake that people make. So if you need to display both of these or use one for APIs and one for the display, you then need to start customizing stuff. It's useful but it's not. Table rate shipping is much more predictable. You kind of know where you're landing. It does require an understanding of your sort of logistic flow as a whole.