Are you using WooCommerce yet?
It's not for everyone, and it's not for every site. If you're doing simple digital downloads, then WooCommerce may be too much for you (and if that' so, look for my upcoming post on Easy Digital Downloads).
But for an all-purpose, general e-commerce solution on WordPress, there's a lot going right with WooCommerce. It's why I write about it a decent amount. And because of those posts, I get emailed questions.
WooCommerce for online restaurants
The question that came in this week was about using WooCommerce for an online restaurant that was doing deliveries. They had their menu online and wanted people to order.
But they wanted something more. They wanted to create the opportunity to let patrons add a tip to the order. And they wanted to do it without lots of code or complexity.
They wondered if the platform supported it. And the good news is that it does.
Woocommerce restaurant tips
Let's walk thru our goal before I walk you thru the steps.
- Create a special product that is a tip product.
- Enable users to define the amount they want to give as a tip.
- Add a place on the cart page to let them add their tip.
- Make sure the tip product doesn't appear in the regular catalog.
As you can see, if we could do it in four steps without a lot of code, I think these guys would be pretty happy. So the question is – is that really possible?
You know the answer don't you? Because what's the point of writing a post about how it's impossible, right?
1. Create a special product that is a ‘tip' product
As you can imagine, most WooCommerce products have a fixed price. When you add attributes that vary the price (like t-shirt size, or color), you add variations, but also at a fixed price. So how do we create a product like this ‘tip'? Now to be honest, I didn't go in and create images, nor did I style things. So this my version of the “raw” answer.
In reality we create this product like we do any other. We create it, without assigning it to a category (because then it might show up as a related product), and we're almost done. But we need to allow it to have any value the customer wants. That takes us to step two.
2. Enable users to define the value of our ‘tip'
To do this, we need to pick up one of the WooCommerce extensions. Don't fret, it's cheap and easy to do. It's called Name Your Price, and it's $29. It is perfect for our tip product. And it lets us configure our product so that users can define any amount they want. All you need to do is go into your product definition and check the box that says “Name Your Price.”
As you can see, you can even create a “suggested price.”
3. Allow users to add a tip from the cart page
Now that we have our tip product, we just need to make it available at the right time – which is when a user looks at their cart.
Now, you could get a little funky here. You could go to the template for the shopping cart (/woocommerce/templates/cart/cart.php) and write some nifty code that would put it under the cart table. You could limit the display of the text to only when the cart a) has products, and b) doesn't already have a tip product. Once you went that approach, you'd want to take that file and place it in your /theme/woocomerce/cart/ location so that it would overwrite the plugin without locking you into hard-coding anything.
But that would require coding.
And that wasn't our goal. So here's the super simple way.
You guessed it. We go into our cart page (that WooCommerce created for us) and above the short code that's already there, we create some text and a link to our tip product.
Yes I know it means it will always show up. But seriously, is it that big of a deal? And remember the point here is fast and simple.
So you can imagine what happens. The person goes to the cart, sees the link, heads back to the tip product, puts in an amount and is taken back to the cart.
4. But wait…it's a product
At this point, you're pretty happy until you hit that “shop” link and notice that the ‘tip' product is listed right there with every other food on your menu. Not exactly what you want, right?
You see, you have options regarding how your products appear – even if you didn't know it. It's because it's kind of hidden away. But let me show you where it is. It's over in that Publish area on the top right of your page. Check out the visibility options.
While normally products are marked as ‘catalog/search' you can decide to make it only ‘search' and then, boom – it disappears from your catalog. Notice that there's no ‘tip' product below.
Tips have never been easier
And that's how you do it. Four steps. Not too hard, and no coding.
Do you have a WooCommerce question? I can't promise to answer it, but I'd love to hear it. Send me a note via my contact page. And be sure to subscribe (orange box) to these posts so you see when a question gets answered.