Awesome Open Source
Awesome Open Source

Craft FoxyCart Hmac

FoxyCart HMAC plugin for Craft CMS 3.1

FoxyCart HMAC is a cryptographic method to prevent people from tampering with your product links.

Using a hash (specifically with HMAC) provides a very secure way to ensure data is not modified. So your add-to-cart links and forms can be locked down, preventing any user from modifying your FoxyCart products.

More information can be found on the FoxyCart HMAC page


This plugin requires Craft CMS 3.1 or later and a FoxyCart account.


To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
  2. Then tell Composer to load the plugin:

     composer require youandmedigital/craft-foxycarthmac
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for FoxyCart HMAC.

FoxyCart HMAC Overview

This plugin provides you with a set of new twig tags called {% hmac %} and {% endhmac %}.

Configuring FoxyCart HMAC

After you have installed the plugin, enter your API Key and Cart URL into the FoxyCart HMAC plugin settings. You can also use environment variables to use different account information between development, staging and production environments.

Next you will need to enable "would you like to enable cart validation?" under Store > Advanced settings in your FoxyCart control panel.

Using FoxyCart HMAC

Once you are setup, you can wrap your add-to-cart links with the new {% hmac %} twig tag. Here's an example:

{% hmac %}
    <a href="">Book Now</a>
{% endhmac %}

If successful, your cart links will now render like this example:||ab1e0225fb2fb7f0a08237fd0f6c1f9f6eaf15594454e63fe8cc222a89413993&price=150||c451bb9b6dc8074201cc2e32fa3c17b48f66b4c847a6440f7cb3a872a6b4bf12&code=1234||6ceb4e60cdfd070730d2c36aa3d65d742922efc98ac69c428c62d20532782614&empty=reset&cart=checkout

FoxyCart HMAC Roadmap

Some things to do, and ideas for potential features:

  • Release it

Brought to you by You & Me Digital

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Php (285,915
Plugin (113,843
Cart (5,102
Twig (3,363
Craft3 (2,659
Hmac (1,290
Craft Plugin (411
Foxycart (4