WooCommerce NFT Downloads

Problem description

The client has a WooCommerce store that sells digital products. These products are related to a Blockchain-based virtual world Decentraland. Since people in this space own NFTs, my client wanted to give access to his digital products based on NFT ownership. On a usual WooCommerce store, to get a digital product you must add it to cart, go through checkout, pay, and then you get access to the download link. But the client wanted his site to check the customer’s MetaMask wallet for the ownership of a particular NFT, and if ownership is confirmed, download access is granted immediately.

Solution

I developed a custom WordPress plugin that added the features my client needed. This is what the single product page looks like with the plugin active.

This front end is developed with React and Redux so that it can handle complex state changes. How it behaves depends on many conditions: Whether the customer has a MetaMask wallet, whether the customer is logged in, what happens when ownership is verified properly, what happens when ownership fails, etc. Because of this complexity, I opted for React instead of plain JavaScript.

On the admin side, you have the option to specify the Ethereum node that will be used to verify NFT ownership

The NFTs that can be used to restrict access are a custom post type. Custom metadata can be set for an NFT.

Then, in downloadable product settings, you can specify which NFTs are required for download access. I made sure to keep the user interface consistent with WooCommerce’s style.

The plugin has extensive unit tests (PHPUnit) and e2e tests (Puppeteer). It uses Object Oriented PHP. It makes use of @wordpress/data to handle client side state which you can see on the Single Product page.

Feedback

Bruno proposed and developed a WordPress plugin solution to a specific need I had related to the blockchain space. He has been a professional communicator and a reliable partner throughout the project, and I also appreciate him on a personal level. He has the required technical skills, the persistence and the ability to pick up new knowledge fast, which I value a lot. Thank you.