PHPackages                             cryptom2/magento-nftloyalty - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cryptom2/magento-nftloyalty

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

cryptom2/magento-nftloyalty
===========================

Magento 2 NFT Loyalty extension that allows to use NFT token as 'Discount Card' for implementing NFT Loyalty Programs.

v1.0.0(3y ago)53MITPHP

Since Mar 28Pushed 3y ago3 watchersCompare

[ Source](https://github.com/torys877/crypto-magento-nftloyalty)[ Packagist](https://packagist.org/packages/cryptom2/magento-nftloyalty)[ RSS](/packages/cryptom2-magento-nftloyalty/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Crypto NftLoyalty Magento 2 Extension
=====================================

[](#crypto-nftloyalty-magento-2-extension)

Magento 2 NFT Loyalty Extension Allows to use NFT token as 'Discount Card' for implementing NFT Loyalty Programs.

Description
-----------

[](#description)

Extension adds new condition for Magento 2 Cart Rules functional and checks if customer has tokens of specified NFTs in wallet.

If NFT tokens are presented in wallet - it applies discount follow rules that are set in Magento Cart Rules.

Extension allows to implement discount programs, partnership program, NFT loyalty programs between magento stores and web3 projects.

`For frontend actions module uses Metamask and web3.js, for backend checks - modified web3.php library.`

How It Works
------------

[](#how-it-works)

Customer can apply NFT on cart page and on checkout page too.

- Customer connect own wallet to website and press `Apply NFT`.
- Customer wallet address is sent to backend and saving to Quote table.
- After saving, Magento gets all NFTS from NFT table and check whether customer has any or several from that NFTs by calling `balanceOf` on NFTs smart contract
- If customer has NFTs from NFT table, found NFT are saved in separate table
- Magento recalculate totals (run collectTotals after applying NFT)
- During collecting totals, Magento runs sales rule total that runs NFT rule and apply Cart Rule if it fits
- Magento updates Summary (totals) sections on frontend for outputting discount for customer

Installation
------------

[](#installation)

### Add PHP Web3 Repository

[](#add-php-web3-repository)

PHP Web3 library uses old version of `phpseclib` (v2), but magento requires version 3. It was changed in web3 fork thus you need to add custom repository for web3.php.

```
        "web3p/web3.php": {
            "type": "git",
            "url": "git@github.com:torys877/web3.php.git"
        }
```

### Composer Installation

[](#composer-installation)

`composer require cryptom2/magento-nftloyalty:v1.0.0`

### Magento Run

[](#magento-run)

`php bin/magento setup:upgrade`

### Hardhat install for testing

[](#hardhat-install-for-testing)

Hardhat allows you to run local ethereum network, deploy demo NFT and test module locally.

Go To:

`{project_folder}/vendor/cryptom2/magento-nftloyalty/hardhatnft`

Run:

`npm install --save-dev hardhat`

`npx hardhat node`

`npx hardhat run --network localhost ./scripts/deploy.ts`

After that commands you should see NFT token address for demo test and hardhat default account, that can be integrated in Metamask.

Features
--------

[](#features)

### Menu Under Marketing Section

[](#menu-under-marketing-section)

[![Menu](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/menu.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/menu.png)

### Adding New NFT

[](#adding-new-nft)

- `NFT Name` - will be used in Cart Rules in admin area for selection NFT (later, for output on frontend to show which NFT was applied exactly)
- `NFT Contract Abi` - not used now, will be used later if NFT needs some custom functional
- `NFT Symbol` - will be used later or instead of NFT Name
- `NFT Address` - address of NFT, Magento checks customer NFT balance using this NFT address

[![New NFT](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/nft_admin.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/nft_admin.png)

### Configuration

[](#configuration)

- `Enabled` - enable/disable functional
- `RPC Endpoint` - endpoint
- `NFT Smart Contract ABI` - Default JSON ABI for NFT smartcontract. Now there is using only 1 function `balanceOf`

[![Configuration](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/system_config.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/system_config.png)

### Apply NFT Section on Cart Page

[](#apply-nft-section-on-cart-page)

[![Cart Page0](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/connect_wallet_cart.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/connect_wallet_cart.png)

[![Cart Page1](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/apply_nft_cart.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/apply_nft_cart.png)

[![Cart Page2](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/nft_applied_cart.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/nft_applied_cart.png)

### Apply NFT Section on Checkout Page

[](#apply-nft-section-on-checkout-page)

[![Checkout Page1](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/apply_nft_checkout.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/apply_nft_checkout.png)

[![Checkout Page2](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/applied_nft_checkout.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/applied_nft_checkout.png)

### Adding Sales Rule With NFT Condition

[](#adding-sales-rule-with-nft-condition)

[![Sales Rule](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/sales_rule_admin.png)](https://raw.githubusercontent.com/torys877/crypto-magento-nftloyalty/main/doc/sales_rule_admin.png)

TODO
----

[](#todo)

Now the extension has base functional and checks only if customer has or no NFT in wallet. But it has much more potential in future.

Here are several TODOs that are going to be implemented later:

- add checking NFT tokens amount and apply discount based on how many NFTs customer has (now it checks only `balanceOf` greater than zero or no)
- output NFT name, rule name or NFT symbol on checkout and cart pages, to show what NFT was applied for discount
- send customer wallet and some data as signed message from frontend to backend during applying NFT (for security)
- mint NFT for customer depending on some conditions (order grand total or amount of purchases in the store)
- output customer wallets(accounts) to choose which should be assigned to website or which should be used for NFT applying.
- implement some kind of NFT interface to keep Discount Rules inside NFTs smart contract and apply them in Magento
- feel free to fork and fix/implement anything if you are interested

Author
------

[](#author)

### Ihor Oleksiienko

[](#ihor-oleksiienko)

- [Github](https://github.com/torys877)
- [Linkedin](https://www.linkedin.com/in/igor-alekseyenko/)

License
-------

[](#license)

Magento NFT Loyalty extension for Magento 2 is licensed under the MIT License - see the LICENSE file for details

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1192d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/68833022e981b0897094481a2ca162b5a862478a83f434aca3f9691b4567ec0f?d=identicon)[Torys877](/maintainers/Torys877)

---

Top Contributors

[![philpher0x](https://avatars.githubusercontent.com/u/46719294?v=4)](https://github.com/philpher0x "philpher0x (1 commits)")

---

Tags

blockchainerc721ethereumloyaltyloyalty-programloyalty-rewardsloyalty-solutionsloyaltyprogrammagentomagento2magento2-extensionmagento2-modulemetamasknftnft-discountnft-loyaltynftloyaltyweb3

### Embed Badge

![Health badge](/badges/cryptom2-magento-nftloyalty/health.svg)

```
[![Health](https://phpackages.com/badges/cryptom2-magento-nftloyalty/health.svg)](https://phpackages.com/packages/cryptom2-magento-nftloyalty)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
