Hi, I'm Dominik Schwind, friend of the internet. Here is /now.

A couple of ways you can follow me around on the internet.

The prefered way would probably be with a feed reader - here is my RSS feed.

If you need more direct access, you can follow me here with Mastodon or similar sites: @dominik@nona.social. You can also follow this blog via @dominik@lostfocus.de.

February 15, 2022

Fun fact: if you’re trying to use the WooCommerce REST API on localhost:80 while developing, you’ll run into a 401 error pretty much immediately:

HTTP/1.1 401 Unauthorized
  "code": "woocommerce_rest_cannot_view",
  "message": "Sorry, you cannot list resources.",
  "data": {
    "status": 401

What you want to do first is get an auth token and secret from your WooCommerce backend: WooCommerce > Settings > Advanced > REST API

Once you’re done this, you can follow this rather smart solution with an authorization header or, if you just need read access to the API, you can do it the quick and slightly dirty way and just add this to your local wp-config.php:

if ( isset( $_GET['consumer_key'] ) && isset( $_GET['consumer_secret'] ) ) {
	$_SERVER['HTTPS'] = 'on';