Tips and gratuities are not common in e-commerce retail. But brick-and-mortar stores with a face-to-face environment are more complex in their client interactions by their nature. I fully realize that my shop is highly unique in its service line offerings - but it's this uniqueness that has led us to using Drupal Commerce for our e-commerce needs. The high level of options to customize the interface has been an invaluable resource.

Example Use Case:
In my shop, we sell retail products from the counter, but my shop is also a coffee-shop as well as a leather repair shop/service center all combined into one. Clients frequently leave tips for the barista, but not always. When clients drop off their leather clothing for alterations or repairs, once they pick up the completed project, they sometimes leave a tip for the leather-worker or seamstress who fixed their clothing. These tips are optional and are added to the credit card charge by the client when they are being rung up for the work or their coffee drink.

Cash tips are inconsequential - that's a bookkeeping issue that's tracked separately. What would need to be captured is the tips that clients write in or type in on credit card receipts.

I realize Commerce POS wasn't necessarily designed with the quick-serve restaurant or coffee-shop in mind, but my gut says this might actually not be too difficult. It might be something as simple as a custom "Gratuity" line-item on the order - or it might be more complicated than that. Perhaps a submodule ("POS Gratuity" or similar?).

This also might be more appropriate for a custom work request. I'm not a developer so I don't have a strong grasp of the depth of work that adding something like this might be. If I knew how to code it myself I would! But I don't have the skills. :(

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TynanFox created an issue. See original summary.

TynanFox’s picture

Anonymous’s picture

This is an interesting feature request. Most POS applications are built with a specific payment gateway in mind, but Drupal Commerce supports numerous payment gateways. My point in this is gratuity is usually added on after the card has been swiped. But it seems like to do that, any gratuity module would have to have specific coding support for specific gateways which can make things more complex. For example, Authorize.net could be set up to authorize an amount for 20-25% higher than the actual sale price, then the tipped amount is captured later after they enter it.

To simplify things though, it sounds like the best way to do it is to add the tip BEFORE swiping the card / accepting cash.

I envision a UI like the ones we see at various food trucks these days, which allows the user to quickly select 5, 10, 15, 18, 20 etc as their tip percentage. This would then add a line item to the order for the tipped amount. Alternatively we could add an order total price component to house the tip. Not sure which would be easier at this point. I'll give it a swing and see what I can come up with.

travis-bradbury’s picture

I have thoughts on a few different scenarios.

  1. Customer pays cash $20 on a $15 order. Cashier enters $20 and POS has an option to add a gratuity rather than expect the whole $5 to be given as change.
  2. Customer pays debit or credit $20 on a $15 order because they added $5 on the terminal. Cashier enters $20 debit and POS prompts to record the difference as a gratuity.
  3. Customer pays debit or credit with gratuity on a semi-integrated terminal. The terminal submodule automatically adds the gratuity to the order.
  4. Assuming any other (non-Paymentree**) integration also identifies that part of a sale was a gratuity.

Maybe finishing an order would require either the total owing to be $0 or if negative, for there to be enough total cash payments to give change back. Otherwise you'd have to resolve the difference by recording a gratuity or fixing a mistake you made in the payment amounts you entered.

Gratuities seem like they'd make a pretty simple line item type we could add to the order.

** The Paymentree module doesn't support tips but Paymentree will return that information so we could add support to commerce_pos_terminal and commerce_paymentree.

Anonymous’s picture

What I'm leaning towards doing right now is building a submodule called Commerce POS Gratuity and have it have basically the same functionality as the Commerce POS Discount module, allowing the cashier to add an arbitrary amount to an order (in the form of a gratuity line item) and have that just get added in to the total. It would have a very similar UI and workflow to the way the Discount module works right now (a button under the Pay button to add a Gratuity).

Anonymous’s picture

I have submitted a PR with the approach I was originally envisioning: https://github.com/AcroMedia/commerce_pos/pull/29

Allows the adding of a gratuity line item to a POS transaction order.

This is the approach I was originally planning on, which adds a button under the Pay/Park/Void section to add a Gratuity. This may not be the best way, but it works at least.

I was already half-way through this when @travis-bradbury suggested we take a different approach and add a way for the commerce_pos_terminal module to add gratuities for debit/credit cards, and have an apply change button for tips if they pay in cash. This adds the tip 'after the fact' instead of before payment is requested.

I'm planning on building another branch to explore this other approach, but figured I would at least put this PR up for review as well. I anticipate that I'll be able to re-use a good portion of this code and maybe even combine the two approaches (allowing for adding a gratuity before or after payment).

travis-bradbury’s picture

I was already half-way through this when @travis-bradbury suggested we take a different approach and add a way for the commerce_pos_terminal module to add gratuities for debit/credit cards, and have an apply change button for tips if they pay in cash.

To expand on that - there's two ways to pay with credit/debit. One involves the terminal submodule and a semi-integrated payment terminal. The POS and the terminal would communicate, allowing us to automatically know that a gratuity was added.

Without that sub-module you're just using payment methods from commerce_cop to say you took a credit or debit payment. That couldn't involve commerce_pos_terminal since it's probably not even installed.

Anonymous’s picture

Status: Active » Needs review
FileSize
44.06 KB

I've added a new feature to the PR that now allows you to automatically apply any Change for an order as a gratuity after payment.

https://github.com/AcroMedia/commerce_pos/pull/29

This should support the majority of use-cases. I'd still like to eventually pursue an integration with the commerce_pos_terminal module, but that will have to be a phase 2, and should probably be tracked in another issue.

smccabe’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
14.44 KB

Get this error if i try to pay without setting up a payment gateway, edge case i know, but shouldn't error.

Also I lose the gratuity option once I hit pay but before I hit finish, it would be really nice if I could still add it then? I dunno if that might be difficult with totals and such, but it would be really nice to add a gratuity later in the flow, since you likely won't know that until the customer pays.

Otherwise functionality seems to work just fine for me. It would be nice to have a gratuities report, but that probably warrants it's own issue.

jjpoole’s picture

FileSize
25.93 KB
31.13 KB

Here's the solution Shawn and I came up with.

Gratuity button that would function similarly to the Discount button. But should only be on the Pay page.

Tip icon (coffee cup) that will immediately apply the change as a gratuity.

TynanFox’s picture

Wow, that all looks really sleek guys, thanks for taking a look at this!

I will apply the patch to my dev site and test it out.

Just to note, at my shop we do not integrate our CC terminals with the Point-Of-Sale. This makes our PCI compliance much easier, at the expense of my baristas/sales associates having to double enter everything (once on the point of sale, then again on the stand alone terminal) but considering how small a business I run, it's just not worth the time pain and expense to integrate the two for a small operation. Maybe when we grow bigger. :) Point being, terminal or Paymentree integration won't be necessary for my specific use case - I was simply more interested in getting the cash drawer reports to balance out.

That is to say, when a client leaves a credit card tip, the barista who received it immediately pulls the CC tip as cash from the drawer. So at the end of the shift, ideally, the CC terminal batch-out total should equal Sales+Tips/Gratuities, and the cash drawer count should add up to Sales-Tips/Gratuities. (My baristas report their tips to me in an Excel sheet - employee tip reporting would likely be outside the scope of this project.)

I haven't looked deep into the patch yet, but was this considered when developing it?

smccabe’s picture

Yes, this patch is specific to manual tips and doesn't handle integration with a payment terminal, which will probably be handled in a totally separate issue.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
64.11 KB
59.7 KB

I refactored the PR to be more in line with what Shawn was thinking. It still needs more styling and design work to match the concepts submitted by jjpoole, but I'm submitting this now because it works functionally and can be tested. I'll submit another patch with the styling changes hopefully later tonight or tomorrow.

Anonymous’s picture

Posted the wrong patch. Here's take 3 with some changes to order of elements.

thejacer87’s picture

FileSize
518.34 KB
1.94 MB
37.39 KB
1.91 KB

almost everything looks good, one issue with the max gratuity though.

the logic for validating when clicking the 'add as gratuity' button was broken (see gifs).

i fixed that logic, though im not sure why there are two separate spots for the validation. and strangely, if you open up the hidden gratuity menu but then click the 'add as gratuity' button, both validations get called for some reason ( i assume bcuz something is submitting both buttons)

thejacer87’s picture

ah stupid sass change got in

smccabe’s picture

Status: Needs review » Needs work

Initial review from Jacer finished, flipping this back to needs work now for the last of the graphical changes

Anonymous’s picture

I've reviewed the patch and it looks good. Thanks thejacer87!

I'll work on the graphical changes more.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
73.61 KB
292.92 KB

I got all of the styling knocked out (see screenshot) and incorporated the fixes from the patch above. Here's the final patch, ready for review.

Also sorry but whenever I run npm build the map file looks a bit different from the style before, but I'm attaching it here regardless. Seems to work functionally.

smccabe’s picture

Issue tags: +rc1 blocker
smccabe’s picture

Rerolled patch against newest dev

smccabe’s picture

Status: Needs review » Needs work
FileSize
3.65 KB

Styling on the gratuity buttons and form is off, compare with the mockup jason did, buttons and text box are wrong sizes. Otherwise everything seems good.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
347.73 KB
35.02 KB
61.83 KB
57.53 KB

Hmmm, that's odd. I rebased it just now and tried it on Firefox, Safari, and Chrome, desktop and mobile and they all looked good. See screenshots. Can you let me know which browser you are on? Also, did the CSS get generated correctly?

Here's a re-rolled patch.

smccabe’s picture

Status: Needs review » Needs work

Tested with re-rolled patch in chrome and ff on ubuntu and in edge and chrome on windows 10 and get same display as my previous screenshot. Are you sure the right changes are getting bundled into your patch?

Looking over the patch, The only sass change I see is a single margin change, nothing else. Also, your patch is actually 8 separate patches, looks like you're generating a patch for each commit instead of the more standard "all in one" patch.

Anonymous’s picture

Hmm, there's definitely more CSS changes than just that. I was adding .patch to the PR (https://github.com/AcroMedia/commerce_pos/pull/29) to generate that patch, so I guess that's how Github does it. I'm attaching a patch created from my PHPStorm to see if it is any different for you. I tested applying it against the latest dev and it worked still.

Anonymous’s picture

Status: Needs work » Needs review
smccabe’s picture

FileSize
318.13 KB

Slight reroll as patch didn't apply against newest master.

cbildstein’s picture

Did a bit of CSS cleanup. New patch attached.

  • Added hover state on blue buttons to match others.
  • Made the heights of the buttons consistent.
  • Cleared float after the buttons so they didn't go over elements below.
  • Adjusted styles a bit to match design better.
Anonymous’s picture

@cbildstein - The CSS changes look fine to me. Thanks.

  • smccabe committed 20f99ed on 7.x-2.x authored by wildkatana
    Issue #2857482 by wildkatana, thejacer87, smccabe, cbildstein, jjpoole,...
smccabe’s picture

Status: Needs review » Fixed

Boom! Merged this baby in! Thanks to everyone who helped build this functionality, with special thanks to wildkatana who did the bulk of the work. Great job!

Anonymous’s picture

Assigned: Unassigned »

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

TynanFox’s picture

This is awesome!
I'm sorry it took me so long to take a look at this - January-May is my busiest time of year at the shop.

But once again thank you all! :)