Martijn has Bear

Sorting GOG Wishlists by Price

The GOG.COM Summer Sale started this week. I wanted to see which items from my wishlist might be priced low enough that I might buy them without an extra thought.

The usual sale page lets anyone scroll down to the full catalog of items and pick a “Sort by” value of “Price”. Either from lowest or highest.

But visiting a wishlist (either signed in or a public list) does not give you that option. You can only filter by price: pick one of four arbitrary buckets, or a fifth with all discounted items.

So here is my additional option. Run the following script in your browser console to immediately sort all the wishlisted items from lowest to highest price:

function priceOfRow(row) {
	return Number.parseFloat(
		row.querySelector("[ng-bind='product.price.amount']").innerText,
	);
}

Array.from(document.querySelectorAll(".product-row-wrapper"))
	.toSorted((a, b) => priceOfRow(a) - priceOfRow(b))
	.forEach((row) => {
		row.parentElement.appendChild(row);
	});

Have fun!