Installing the GRIN Magento Module
  • 14 Jun 2022
  • Dark
    Light
  • PDF

Installing the GRIN Magento Module

  • Dark
    Light
  • PDF

Article summary

To finish integrating with Magento, you must install GRIN’s Magento Module. This will allow GRIN to fully access your Magento instance, its products, and more so you can seamlessly use Magento within GRIN. 

The full installation process consists of three parts: 

  1. Installation 
  2. Configuration 
  3. Webhook verification 

All of these parts, as well as an additional Troubleshooting section, will be described below. 

Note
We highly recommend your Magento Admin completes the module setup. If you need further assistance, reach out to GRIN’s Support team.

What You'll Need 

  • A webhook authentication token. To get a token, you must first integrate with Magento, then contact GRIN Support to obtain the token. For more information on integrating with Magento, see our help article Integrating with Magento. 
  • Composer v1, which you can download directly from Composer. If your server is running Composer 2.X, you can download Composer v1 to the working directory, then explicitly use the v1 executable with any composer command by specifying ./composer.phar for any composer related commands, as shown below. 
curl -O "https://getcomposer.org/download/1.10.22/composer.phar" 

// Downloads v1 version of Composer

chmod a+x composer.phar

// Sets the file as executable

How to Do It 

Installation 

  1. SSH to your Magento store. 
  2. Navigate to the root directory.
  3. Run the following commands: 
composer config repositories.grin vcs https://github.com/grininc/grin-magento-module

composer require grin/module

// If you see warnings about installing Composer v2 ignore them. 
// Magento does not currently support Composer v2

bin/magento setup:upgrade

bin/magento setup:di:compile

bin/magento setup:static-content:deploy

bin/magento cache:flush

// Optional command to ensure the module is enabled
bin/magento module:status | grep Grin_Module

// Make sure the cron is running

bin/magento cron:run

The GRIN Module should now be installed in your Magento 2 store instance. 

Configuration 

Once you’ve installed the GRIN Magento Module, you must configure the module to work with your store. 

  1. Log in to your Magento 2 Admin Dashboard
  2. Navigate to Stores > Configuration. This will open your store’s Configuration settings. 

  1. Navigate to Services > GRIN (Influencer Marketing). 

  1. Set the GRIN SDK > Enable field to Yes. This enables GRIN’s affiliate tracking scripts. 

  1. Set the Cart widget > Enable field to No. 

Note
Enabling the Cart widget setting adds a GRIN cart widget to your public cart view. This is typically used for debugging purposes, and generally we recommend that this setting is set to No otherwise.
  1. Set the Webhooks > Enable field to Yes. This enables webhooks. 

  1. Enter your webhook authentication token in the Webhooks > Webhook authentication token field. 

  1. Click Sales.

  1. Click Shipping Methods.

  1. Set the GRIN Influencer Shipping > Enabled field to Yes. 

Your GRIN Module is now configured to work with your Magento 2 store instance. 

Webhook Verification 

  1. Generate a webhook message. You can do this by modifying the quantity or description of an existing product. 
  2. Navigate to System > GRIN Module Queue Messages. This will open your GRIN Module Queue Messages table. 

  1. Confirm the Status with each record reads as “Complete”. 

Troubleshooting 

If the Statuses of your records appear as “New” or “Error” when verifying your webhooks, then you can check the following solutions to troubleshoot. If you continue to have errors, contact GRIN Support. 

  1. Run the Magento 2 Cron Processes 

The grin webhook process may need to be killed and the Magento CLI cron command should be run, as shown in the code block below.

// Kill any processes related to the GRIN Module still listed

ps -aux | grep grin_module_webhook
kill <pid>

// Run the Magento 2 cron processes
bin/magento cron:run
  1. Manually Add Webhook to the Cron 

The grin_module_webhook may not have been automatically added to the cron. If this is the case, confirm that the queue job was added to the /app/etc/env.php file.

...
   'cron_consumers_runner' => [
    	'cron_run' => true,
    	'max_messages' => 20000,
    	'consumers' => [
           'consumer1',
           'consumer2',
           'grin_module_webhook',
	     ....
         ]
    ],
...

That’s it! The GRIN Magento Module should now be successfully installed and configured. Now, you’ll be able to utilize your Magento store within GRIN.


Was this article helpful?