Crypto chump change

I know artists who are exploring crypto as a new way to earn money from their work — something that is notoriously hard given the soulless priorities of our economy — but I can’t see it as anything other than a get-rich-quick scheme… or a pyramid scheme… some kind of a scheme (with all the negative connotations that word carries in the US). You might get rich — some people obviously have — but you probably won’t, and ultimately crypto is not going to solve any of our problems… but it’s already created some novel ones.

I’ve been following Molly White’s blog for a while now. I really like her approach and insights. While I personally have less than zero interest in getting into crypto, I’m somewhat fixated on it right now — how it’s changing, how its myriad flaws are gradually being revealed, and how people are misunderstanding what it really is, how it works, and how it’s impacting society and the planet. (But yes I will admit that any time I see someone is into it, my immediate assumption is they’re either an Ayn Rand acolyte or a chump.)

Speaking of Molly White, she also contributed to (and hosts) this group-annotated version of Kevin Roose’s ridiculously pro-crypto “explainer” article recently published by the New York Times. Essential reading on the topic. (The annotations that is, not the original article.)

“It doesn’t suck.”

Is it possible to be excited about a text editor? Well… yes. When it’s good enough to be an essential tool for decades.

Back in 1994 when I was a junior in college and the web was emerging, I wanted to learn how to build web pages. The somewhat helpful person in the Gustavus computer store (why did I go there? I guess because I wasn’t taking any CS classes so I didn’t know any of the faculty) told me to download BBEdit, so I did. That didn’t help me to learn HTML, but it became the program I used to write it as I did learn.

I’ve dabbled with other apps over the years — including PageSpinner in 1996, at the recommendation of my boss at my first professional “webmaster” job*, and HomeSite in the brief period when I mainly worked on Windows 2000 — but guess which program is open on my Mac right now; which program I was busy writing code in moments before I read this Daring Fireball article.

* Yes, that really was my title. I gave up on PageSpinner and switched back to BBEdit shortly thereafter, because although I liked PageSpinner’s color coding (before BBEdit supported it, or at least before I figured out that it did), it bugged me endlessly that it used proportional fonts.

A slow-motion apocalypse

I could be talking about any number of current events with a title like that, but in this case I’m referring to last September’s “SSL Apocalypse” that came due to the expiration of an X3 root certificate used by Let’s Encrypt when connecting to really old client OSes. (Not that users think their computers/devices are really old, but in Internet terms, they are.)

Now, over six months later, I am still sporadically dealing with this issue. I was responding this morning to a client about the issue, and I wanted to email her a link to the blog post I remembered writing on the day it happened. But, maddeningly, I could not find it anywhere here.

That’s when I remembered, I actually have two blogs.

So, in a simultaneous act of self-promotion and, uh, self-reminding, here’s a link to that post on my other blog, on the site for my WordPress plugin ICS Calendar:

Unexpected Side Effects of the Let’s Encrypt Apocalypse

There we go. Now you know about ICS Calendar, and I won’t think I’m losing my mind when I come back here in another six months and can’t figure out where the heck this blog post went!

How to make the WooCommerce main shop page show featured products only in 2022

Sorry for the click-bait-y title (especially the “in 2022” part), but I searched fruitlessly for way too long and found too many woefully outdated answers to this. Ultimately what I found still wasn’t quite the complete answer, so I modified it a bit myself to arrive at the following.

The goal here is, as the title suggests, to get the WooCommerce main shop page to only show your featured products. Why this isn’t just a checkbox option in WooCommerce is beyond me. But then a lot of the decisions made by the WooCommerce dev team are beyond me. (Excuse me, Professor Brainiac, but I’ve built e-commerce platforms from scratch and, uh, I think I know how a proton accelerator… oh wait, never mind.)

Anyway, this is it:

add_action('woocommerce_product_query', function($query) {
    if (is_shop()) {
        $query->set('tax_query', array(array(
            'taxonomy' => 'product_visibility',
            'field' => 'name',
            'terms' => 'featured',
            'operator' => 'IN',
        )));
    }
});

What exactly is happening here? Well, as noted by the most helpful resource I found, since WooCommerce 3 (currently on 6.1.1), the “featured” status has been handled by the product_visibility taxonomy, and not by the _featured post meta field. So this needs a tax_query and not a meta_query.

Beyond that, we’re making an extra check that we’re on the shop main page — so this doesn’t affect category archive pages. And we’re using the woocommerce_product_query hook, not pre_get_posts as some other examples suggest, so it only runs on WooCommerce queries and we can skip adding extra conditionals for pre_get_posts to run on, you know, every single post query on every page of the site, including admin.

That’s all there is to it. Now your main WooCommerce shop page will only display featured products, and nothing else changes.