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.

#rpm12 day 3: A certain sameness

No profound personal reflection today, just some mundane observations on my efforts last night to continue exploring new territories in iPhone-based music making.

Not so much exploration. That’s the failure. Last night I did precisely what I had been trying to avoid: I went back and spent almost all of my time tinkering with and perfecting the piece of music I had made the night before, instead of setting it aside and cranking out something new.

All is not lost, as I did start working on a new piece of music during a brief break yesterday afternoon, which will be entirely composed and arranged using the Xenon app.

But my goal of making music that is more experimental is getting a bit off track. I feel like tonight I have to record an album’s worth of extended free-form improvisations as penance. Yes, that’s what I’ll do.

The good news is, the track I tinkered with sounds great!

No one’s listening

Comments. Over the past decade, the Internet has become inundated with them. Ten years, ago, the concept of a “blog” was considered cutting edge, by those who even knew what they were. Now, they’re everywhere, and their general format — a dated archive of topical posts by one or a small number of authors, each of which is trailed by a string of reader comments — has become the standard structure for most news and information websites.

But… comments. Oh, comments. They help turn a one-sided online journal into a thriving community of engaged individuals. Or not. By now, the true nature of most comment threads — a bunch of morons yelling “FIRST” followed by a bunch of even bigger morons ranting at each other without ever engaging — is so well-known, so obvious, that it’s boring even to mention and somewhere between tiresome and excruciating to experience.

So, how long will it be before comments go the way of Internet Explorer 6 and Flash? (Oops… have I spoken too soon?) I think the day is coming soon.

Comment ça va?

Many prominent blogs, Daring Fireball for instance, have long eschewed comments (although the persistent commenters have found a way around that). Others are following suit. And now, it’s easier than ever for frustrated readers to take things into their own hands and silence comments wherever they go online.

I can’t tell you how tempting shutup.css is. I’ve spent more time angrily scrolling through insipid comment threads than I care to remember… but it’s driven me to rant before.

Jumpin’ Jack Flash

But, just like Flashblock (or, for you Safari users, ClickToFlash), I think if I were to try it, I would quickly go back, no matter how annoying the comments are.

Don’t get me wrong: I feel the same way about comments as I do about Flash. Both have potential, but far more often than not they are just intrusive and annoying rather than useful. I tried Flashblock for a few days last week, and I was happy not to be intruded upon with overlaid advertisements, intro animations, and other bandwidth- and time-wasting nonsense. But turning off Flash also meant I had to click an extra button to watch most videos, and even worse, to upload files on my WordPress blogs… not to mention the client sites I’m developing that have JWPlayer and YUI Uploader embedded in them. So, as much as I want to be rid of Flash, and as content as I am not to have it in iPhone OS, I decided I needed to turn it back on in Firefox on my MacBook.

The same goes for comments, but I don’t even need to try shutup.css to know I wouldn’t want to keep it. Sure, I hate the comments on most news and tech sites I read, but I like them on my own site, and I like them on the sites that I want to comment on.

Turn it on again

So, with both Flash and comments, there are proponents and opponents. It seems in the recent dust-up over Flash (or the lack thereof) on the iPhone and iPad, the most fervent supporters of Flash are Flash developers, or people who just hate Apple. And with comments, well, it’s pretty obvious: people who like comments (or, more specifically, like to make them) want them, and just about everyone else doesn’t. It’s clear to me that comments rarely add value, and they often detract from the sites they’re on. On the other hand, allowing comments on my sites has for the most part added value to them, and, critically, commenting on other sites has driven traffic to my sites.

Does this mean that the act of commenting is purely, or at least primarily, an act of shameless self-promotion? Perhaps. I wouldn’t post a comment if I didn’t think the comment had merit on its own, but I’ve also consciously posted comments on some sites knowing that doing so was a prime opportunity to bring some of those sites’ readers over to my sites.

And in the end…

By now it is becoming increasingly apparent to me that both Flash and comments are facing their demise. At least someone at Adobe gets it: Adobe is not in the Flash business, they’re in the “helping people communicate” business. Flash has been a tremendous tool for allowing people to communicate online for a long time where open standards have lagged behind. But by its nature, Flash is fundamentally opposed to what the web is really about. Nobody “owns” HTML or CSS or JavaScript. They’re open standards, and they’re the foundation of the web. Proprietary, closed technologies limit the web’s growth. Flash requires a plug-in (even if just about every computer comes with it preinstalled); Flash files are a “black box” to search engines and text-based systems; the technology resides in the hands of a single company whose fate will dictate the fate of all of the content locked into the format, and the fortunes of the creators of that content.

Comments, too, are about helping people communicate. But it’s become clear that — more or less, depending on the particular site — few people who engage in comments on a blog are really all that interested in communication. If comments cease to be seen as communication and instead become an ugly, depressing wasteland at the bottom of web pages, then they’ll die off too.

Looking forward into a new decade, I am beginning to see the old alignments of the Internet as we’ve known it falling away. There’s a convergence of new standards, new devices, and new means of communicating. And this naturally means that certain older ways, “standards” or not, will fade from our day-to-day experience. I’ll certainly be happier to see Flash go than comments, but then again, I think I’ll do just fine either way. Let me know what you think. Or not.

Google drives a stake in Internet Explorer 6’s coffin

It’s no secret that I’m among a (likely overwhelming) majority of web designers and developers who want nothing more (well, probably) than to eradicate every last copy of Internet Explorer 6 still in use worldwide. I’ve said it all before (hence the “2009” on the mocked up tombstone). IE6 is a bane to our industry and it degrades its users’ experience of the Internet in ways they don’t even realize.

Fortunately, the 800-pound gorillas of the Internet — companies like Google (and their subsidiary, YouTube) and Facebook — are taking action, at long last cutting their support for this antiquated browser. Yesterday Google sent this notice out to all Google Apps users with administrative access:

Dear Google Apps admin,

In order to continue to improve our products and deliver more sophisticated features and performance, we are harnessing some of the latest improvements in web browser technology. This includes faster JavaScript processing and new standards like HTML5. As a result, over the course of 2010, we will be phasing out support for Microsoft Internet Explorer 6.0 as well as other older browsers that are not supported by their own manufacturers.

We plan to begin phasing out support of these older browsers on the Google Docs suite and the Google Sites editor on March 1, 2010. After that point, certain functionality within these applications may have higher latency and may not work correctly in these older browsers. Later in 2010, we will start to phase out support for these browsers for Google Mail and Google Calendar.

Google Apps will continue to support Internet Explorer 7.0 and above, Firefox 3.0 and above, Google Chrome 4.0 and above, and Safari 3.0 and above.

Starting this week, users on these older browsers will see a message in Google Docs and the Google Sites editor explaining this change and asking them to upgrade their browser. We will also alert you again closer to March 1 to remind you of this change.

In 2009, the Google Apps team delivered more than 100 improvements to enhance your product experience. We are aiming to beat that in 2010 and continue to deliver the best and most innovative collaboration products for businesses.

Thank you for your continued support!

Sincerely,

The Google Apps team

I have never been so delighted to receive a mass email message before. I think a key phrase in there, so subtle you might miss its full meaning, is this: “as well as other older browsers that are not supported by their own manufacturers.”

Technically Microsoft does still support IE6, reluctantly, and will continue to do so until 2014. But, there’s support, and then there’s support. In “supporting” IE6, Microsoft pledges to make a concerted effort to keep IE6 patched against its most egregious security holes (as they’re discovered, and hopefully before they’re widely exploited), but Microsoft doesn’t really support using IE6, if you catch my drift. They are pretty much pleading with users to upgrade, going so far as to pledge charitable donations on behalf of users who upgrade.

So, yes, you are literally doing the world a favor by abandoning IE6.

Cool wedding design

Cabel Sasser's awesome wedding invitations (Awesome? Wedding invitations?)I’ve never really thought anything about weddings was “cool.” Sure, our wedding was fun… at least the reception was, especially the 6-piece jazz combo. That was the part I insisted on (and I sat in with them, demonstrating that I had reached the limit of my abilities as a saxophonist).

But “cool?” Well, no, not really.

Then I saw the invitations (and everything else) from Cabel Sasser’s wedding.

I was already impressed with Cabel just for the greatness that is Transmit. Plus, when I lose my registration code (which seems to happen always), the message I get back from Panic at least appears to be sent personally by Cabel himself. Nice touch.

Anyway, back to the wedding. I consider myself a creative person (after all, it is my job, at least to some extent!) but I don’t think in a million years I’d have come up with something this creative and, well, cool for wedding invitations. Then again, maybe if we hadn’t gotten married straight out of college we’d have had more time to come up with something. Still, this would be hard to top. I love the invitations. The combination of the techie pixel-style art and the tactile, “old world” feel of the letterpress printing is brilliant.