WooCommerce code snippet: convert the Order Notes field into an EU VAT ID field

The scenario: My WooCommerce store has no need for the Order Notes field. In fact, up until now I had it hidden on the checkout page. But what my site does need is an EU VAT ID field. The portion of my business that takes place in Europe is, so far, well below the VAT reporting threshold, but I am increasingly being asked by customers to provide an invoice containing their VAT ID.

Well, my site does already produce PDF invoices. But there was no way for customers to include their VAT ID on the invoice. Until now.

A simple code snippet converts the existing WooCommerce Order Notes field into an EU VAT ID field, including changing it from a <textarea> to an <input type="text"> field. Put this in your theme’s functions.php file, or wherever else is appropriate in your setup:

add_filter('woocommerce_checkout_fields', function($fields) {
    $fields['order']['order_comments'] = array_merge(
            'class' => array('eu-only'),
            'label' => 'EU VAT ID',
            'type' => 'text',
    return $fields;
}, 10, 1);

That’s it. You can stop right here. But you may notice a line in there that seems unnecessary: 'class' => array('eu-only')

What’s that all about? Well, I’m using that with a bit of jQuery to enhance the functionality: only showing my new EU VAT ID field when the user’s selected Billing Country is an EU country.

Here’s a JavaScript function you can use to dynamically show/hide elements with an .eu-only CSS class, depending on a given passed-in value:

function showHideEUOnly(val) {
    var eu = ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'ES', 'SE', 'GB'];
    if (eu.indexOf(val) != -1) {
    else {

I obtained the list of EU VAT-applicable countries here, and I decided to include 'GB' (the United Kingdom) in the list, despite… y’know, uh… Brexit, because I have the vague impression that UK customers may still be impacted by VAT policies. (Being a dumb American, I don’t know much about it. I think maybe the UK has its own VAT now? Anyway, suffice to say, you may want to modify your list of 2-digit country codes in the eu array, as applicable to your situation.)

This function isn’t going to do anything unless it’s called though, so let’s do that. Here’s a bit of jQuery that will call it both on the initial page load and any time the Billing Country field changes:

jQuery(function() {
    if (jQuery('body').hasClass('woocommerce-checkout')) {
        jQuery('select[name="billing_country"]').on('change', function() {

Both of these JavaScript snippets can go in a script.js file in your theme, or wherever else is appropriate in your setup.

That’s the end of the story, but there’s more…

Incidentally, there’s more to my custom setup. I’ve significantly modified the layout of my checkout page. I’ve got WooCommerce configured for billing addresses only, with this setting in Shipping Options:

I then used CSS to hide everything else in the second column (including, up until now, the Order Notes field) and moved the product summary and payment information up into that space. Explaining all of that is outside the scope of this post, but one thing you may find useful is my CSS for hiding the “Additional Information” <h3> heading. This selector is a bit of overkill, but it works:

body.woocommerce-checkout .woocommerce > form.checkout .col2-set > .col-2 .woocommerce-additional-fields > h3:first-child { display: none; }

There’s context in my CSS file to justify all of that, but you should be able to accomplish the same with just this:

.woocommerce-additional-fields > h3 { display: none; }

On effective altruism, longtermism, crypto bro billionaires, and the boringness of maintenance

This morning I was reading a Vox article entitled How effective altruism let Sam Bankman-Fried happen, and if that title isn’t enough to scare you off, the first few paragraphs probably will be.

Of course, I am a glutton for punishment, especially when people in their third decade think they have solutions to all of the world’s problems. Not to be a crusty curmudgeon, even though as a “Gen X”er it seems to be my destiny. I just feel like you have to have first-hand memories of the 1980s for proper context on what’s happening today. Or maybe not, but you at least need to be even more cynical about the claimed promise of crypto than the author here. You know, cynical enough to not take the money in the first place.

The problem actually is longtermism

One section of the article begins with the subhead “The problem isn’t longtermism.” But I would argue that, in fact, it is the problem. Or rather, it’s one of a cluster of problems that all come out of the heads of people who think they are smarter than everyone else and somehow have The Answers that are beyond the grasp of mere mortals.

It’s the same mentality that lets a person make the choices (often building on past choices by their forbearers, the ones who allowed them to be “born on third base, thinking they’d hit a triple”) that lead to becoming a billionaire in the first place. It’s a status that can only be achieved on the backs of others.

But whether you’re a billionaire striver, an aspiring Mars colonist, just an ordinary “maker,” or a grandiose philosopher of the distant future, the common thread is that it’s more fun, more inspiring, to invent something — to inhabit a fresh, clean, newly-constructed mental space — than to do the messy, mundane, boring work of maintaining what we already have. Of cleaning up other people’s messes. Of learning how someone else’s invention works, because they’ve moved on to the Next Big Thing and now you’re the one charged with keeping the previous Next Big Thing up and running.

I get it. It’s the same for me, in many ways. I’m a “maker.” I work as a consultant, brought in to create new systems, that then get handed off to internal staff to keep running, while I move on to the next client. But I’m not claiming to solve all of the world’s problems; I’m just making something new that people ask me for when their old thing stops working.

OK, the problem actually is billionaires. Period.

It’s dangerous when the means to solve society’s big problems are concentrated in the hands of a small group of billionaires, and we are left to trust their vision for how that money should be used. These are the guys (and it’s pretty much always guys — bros, if you will) who get that thrill out of grandiose thinking, who don’t want to deal with the messy realities all around us. They don’t want to fix problems. They want to invent something, clean and shiny and new. Don’t clean up Earth; move to Mars. Don’t improve public transportation, distract us with ludicrous promises of tunnels and tubes, so we buy your fancy new cars instead. Don’t do the hard, complicated work to improve the actual lives of the billions of humans who are living in poverty today; concoct some imaginary future event that might kill billions of people, and invent a fancy new high-tech gizmo that will prevent that event from happening.

Later on, the article does get into a lot of the problems with big longtermist philosophy and silver spoon crypto bros who think they understand all of the world’s problems better than anyone who actually has any of those problems in their own lives.

But ultimately, for me, it all simply comes back to the idea that billionaires shouldn’t exist. And since they shouldn’t exist, they shouldn’t be making decisions about how to fund solutions to society’s problems.

On canceling my Minnesota Twins season tickets, and the nature of professional sports

I’ve had Twins season tickets since Target Field opened in 2010. Not a full-season package, mind you. I don’t see how anyone who works for a living has time for 80 baseball games a year. Or even 40. But I’m now in my 13th year of a 20-game package, and most years (minor inconveniences like pandemics aside), I’ve actually managed to make it to 16 or 17 of them.

This year I’ve had a lot going on, and have had to reschedule (ticket exchange is a nice new benefit in the past couple of years) or miss entirely over half of the games in my package. Combine that with increasing concession prices with limited options (especially for someone who doesn’t eat meat), few other season ticket holder perks I find interesting, and the perennial futility of this particular team, and each year it has been harder and harder for me to justify renewing.

Finally over the weekend, when I missed two games in three days due to more schedule conflicts — mixed with a dash of struggling to care about a team that is once again failing to live up to even modest expectations of success — I decided I was done with it, and I emailed my rep to say I want to cancel for next season.

Last night was my first game since canceling. And what a game it was! The Twins had just finished getting swept in a 4-game series by the division rival Cleveland Guardians, a series that knocked the Twins — who had dominated the division in the first half of the season — down to third place, and below .500 for the first time since April.

But they came roaring back in last night’s game against the lowly Kansas City Royals with three home runs, and by the middle of the fifth inning, the crowd was beginning to notice that Joe Ryan also had a — shhh! don’t say it out loud! — no-hitter going.

By the end of the seventh inning, he still had a no-hitter going, and the excitement in the stadium was palpable. We might be witnessing Twins history… their first no-hitter in over a decade! But Kansas City was not making it easy. Pitch after pitch after pitch was fouled off, and by the time the last out was recorded in the seventh, Ryan had already thrown 106 pitches.

Twins manager Rocco Baldelli is a serious analytics guy. The whole game is numbers to him, to the detriment of fan excitement or even a moment of unpredictability. And one of the biggest numbers is that magic “100” pitch count. Once your starter hits 100 pitches, he’s done, no matter what. So I knew there was no way he was going to let Ryan come back out in the eighth, no matter how much of a case he might be pleading in the dugout.

So it was… Jovani Moran kept the no-hitter going through the eighth, but with one out in the ninth, he walked two batters, then gave up a double. The no-hitter was gone, as was the shutout. In the end, the Twins won, 6 to 3, but it felt worse than a loss.

I woke up this morning still thinking about the game, and getting philosophical about it, and about my waning enthusiasm for this team I have loved (at least, in fits and starts) since I was in middle school and they won their first World Series.

What is the purpose of professional sports? They are entertainment. That is their only purpose.

Fans pay a great deal of money to be entertained, and the people who comprise the “sports industrial complex” — professional athletes, coaches, staffs, broadcasters, etc. — make their very comfortable livings from the money those fans pay.

But guys like Rocco seem to think sports exist for some other reason unto themselves. That they matter in some way apart from the fans.

They do not.

If you are not making the game entertaining for the fans, you are failing at your job. And if you allow the game to be entertaining for the first 7/9, and then make a decision that ruins the remaining 2/9, you’re still failing… even if you win.

But here’s the thing: even if sports did exist for a reason unto themselves, Rocco’s approach is not going to lead to success. A conservative, risk-averse, analytics-obsessed approach can only take you so far. Baseball needs an element of risk, of surprise. Bold, unexpected, sometimes irrational decisions are what make a good team great, or at least make an average team fun to watch.

The best the Twins will ever be with Rocco’s approach is “good.” Yes they touched greatness in 2019, with their first 100+ win season since 1965, and setting an MLB record for team home runs in a season, but something strange was going on in the entire MLB that season with juiced balls or something. Then, of course, that team that was so dominant in the regular season still instantly fell apart in the postseason, because that’s what the Twins do. And that’s never going to show up in your analytics.

The things I make don’t exist

Like most “creatives,” I have an impulse — maybe a compulsion — to make things. I’ve often reflected on the nature of this impulse, wondering why I simply feel in my bones that I need to do this.

I think in some ways it’s about mortality. Our existence is temporary and fleeting. We want to leave a mark on the world. Something that says “I was here.” The impulse to leave a mark often takes a dark turn, but even when it doesn’t, the fragility of our modern world calls into question the extreme vanity of thinking that somehow your existence matters enough that you need to construct monuments to yourself.

But in my case, there’s an even weirder element to the impulse. Nothing I make exists. That is, it doesn’t exist as physical objects. The closest I come, I guess, is if I print out a piece of sheet music I’ve composed. But unlike a painter, a sculptor, a knitter, a builder… the things I make are even more fleeting and ethereal than my own existence.

Sound waves in the air. Momentary flashes of pixels on a screen. The flow of electrons inside computer chips. None of it is real outside of the moments someone experiences it. And worse, most of it is dependent upon the right hardware and software continuing to operate to manifest those moments again in the future. And all of it depends on electricity.

Intermittently through the years I have run an online shop where I sell merchandise featuring my designs, all created on a computer. I just launched a new one. But I don’t make the products. I certainly am not stitching together the t-shirts or firing the coffee mugs in a kiln or… doing whatever it takes to physically create a sticker. I’m not buying the blank merchandise and printing my designs on it. I’m not even warehousing stock. Everything I sell is print-on-demand, and the “photos” of the merchandise on the site are just composites created by the fulfillment vendor’s software.

That gave me the idea for this t-shirt. It doesn’t exist. And as long as no one ever orders one, it will stay that way.

I don’t have a good desk chair

I don’t have a good desk chair.

I can’t sit in my not-good desk chair for very long. It’s not really a desk chair, even, other than that it’s a chair, and it’s at my desk.

It’s just an $80 IKEA side chair, “walnut,” which I feel probably needs to be in quotes since it’s from IKEA. At least it is solid wood, not a hardened slurry of glue and sawdust covered in a “veneer” that’s actually just a paper sticker with wood grain printed on it. Which is a factual description of some IKEA furniture (that does exist in the house of a couple who are on the verge of 50). This chair is undoubtedly real wood.

But a wooden chair is not a good desk chair.

It is not a good desk chair even when it has a memory foam cushion on it. Not even when that memory foam cushion is on top of a silicone honeycomb cushion, although now we are getting somewhere. (But where is that? One of the Amazon reviews of the cushions praised its effectiveness in the wheelchair of its buyer’s nonagenarian grandfather.)

I don’t have a good desk chair.

But do I really want a good desk chair? Over the past year I have converted my workstation to a fully portable setup. I’ve worked with a laptop as my sole computer for over a decade, and now my second monitor is an iPad. I can bring my two-screen setup anywhere.

For years we’ve been told that sitting at a desk all day long shortens our lives. I hate sitting at a desk all day anyway. And years of working in offices, where someone else paid for the series of various “real” (and surely quite expensive) desk chairs I used, taught me that there is no such thing as a good desk chair, at least not for me.

I do not sit with perfect posture. I do not sit in one position. I do not sit back in my chair, so lumbar supports are pointless. Except when I do sit back in my chair, in which case I am usually sprawled low, and the lumbar supports are again pointless.

But sitting perfectly in a precision engineered desk chair all day is still sitting at a desk all day. And when you do that, YOU DIE.

I don’t want a good desk chair.

And I really don’t want a standing desk.

(Neither do my feet, especially during one of my bouts of plantar fasciitis, such as the one I’ve been enduring over the past month as I write this.)

I just want to move around.

I am self-employed, and I have a mobile workstation. So I spend part of the day in my not-good desk chair. I spend part of the day in a lounge chair (IKEA) in our bedroom, with my feet up and the laptop living up to its name. Or that midcentury modern chair (a rare splurge from West Elm) in the living room, again with my feet up and the laptop laptop. Or — now that the weather is finally nice — sitting under the big umbrella at the cafe table we have on our deck, as long as I can find the perfect spot where its metal mesh top is unwarped and my laptop doesn’t wobble with every keystroke. Or in one of the Adirondacks* on the deck, in the afternoon when they’re shaded. Or sometimes even standing (!) with my laptop on the countertop of the pass through between our kitchen and dining room.

I’ve got options that don’t involve a good desk chair.

If I had a good desk chair, I would feel compelled to use it all the time. And then… YOU DIE.

*That would be a molded plastic Adirondack, of course. From Target. We are in our late 40s and still nearly every piece of furniture we own is from either IKEA or Target.