Requirements
Not yet supported or tested:
- Hyvä Checkout isn’t supported yet. A store with a Hyvä theme is supported when its checkout is Magento’s own.
- Adobe Commerce, the paid edition, hasn’t been tested with the module yet.
- Themes that are based on neither Luma nor Hyvä haven’t been tested.
https:// and point to an address that’s reachable from the public internet. HTTP basic authentication on the store’s OAuth and REST routes stops LoyaltyLion from connecting.
Install the module
Run these in your Magento root directory, as the user that owns your Magento files:setup:upgrade with your usual deployment steps, such as bin/magento setup:di:compile and bin/magento setup:static-content:deploy.
setup:upgrade adds the module’s loyaltylion_outbox table and a loyaltylion_tier customer attribute, and registers an integration named LoyaltyLion under System > Extensions > Integrations. Nothing reaches LoyaltyLion and nothing shows on the storefront until a website is connected.
Check cron
The module’s jobs run in a cron group of their own,loyaltylion, in a separate process, so a slow answer from LoyaltyLion never delays your store’s other jobs.
A crontab that runs
bin/magento cron:run without --group, as bin/magento cron:install sets it up, runs this group too, so there’s nothing to add. If your crontab runs named groups only, add the loyaltylion group to it, every minute:
Connect your store
You need a LoyaltyLion program for the store, and a LoyaltyLion user that can manage its account.1
Activate the integration
In Magento admin, go to System > Extensions > Integrations and select Activate next to LoyaltyLion, or Reauthorize if Magento shows that instead. Magento lists the resources the integration asks for. Allow them, and Magento opens LoyaltyLion in a new window.
2
Choose the program
Sign in to LoyaltyLion if it asks. The Connect your store page shows your store’s address. Check it’s your store, choose the program, then select Connect store.If your store has more than one website, LoyaltyLion asks which one the program is for. Choose it and select Connect website.
3
Read the result
The Store connected page names the store, the program and, for a store with more than one website, the website.
- If it says your store now sends its orders and customers to LoyaltyLion, the website is set up, and the window closes by itself.
- If it asks you to enter the program’s settings in Magento, follow Enter the settings yourself.
Your Loyalty Program is completely hidden from your customers until you choose
to launch using the button on the LoyaltyLion admin dashboard.
How LoyaltyLion sets up a website
LoyaltyLion sets the website up only when your store is at the address of the program’s Store URL (in LoyaltyLion, Settings > General). It compares the host name alone and ignoreshttp or https, a leading www., the port and any path. If the two don’t match, the store is still connected, and you enter the settings yourself.
To set the website up, LoyaltyLion:
- Creates an API key for the program with the
read_customers,write_customersandwrite_ordersscopes, or reuses the one it made before. - Saves the four settings below in the website’s configuration. The API key and SDK secret token are stored encrypted.
- Cleans Magento’s configuration and full page caches, so that cached pages pick up the LoyaltyLion script.
Enter the settings yourself
Go to Stores > Configuration > LoyaltyLion > Connection and switch the scope to the website. The settings are at website scope only, so the Default Config scope doesn’t show them. Under Connect this website to LoyaltyLion, enter:
Save the configuration, then refresh the full page cache under System > Cache Management. Pages cached before you saved don’t carry the LoyaltyLion script.
Each setting turns on part of the module:
- With a Site token, the storefront loads LoyaltyLion.
- With an SDK secret token as well, LoyaltyLion knows which shopper is signed in.
- With a Site ID and an API key, the module sends orders and customers, and checks free product rewards with LoyaltyLion.
Stores with more than one website
Each Magento website connects to one LoyaltyLion program, and its settings are saved at that website’s scope. To connect another website, give it a program of its own:- In Magento admin, select Reauthorize next to LoyaltyLion under System > Extensions > Integrations.
- On Connect your store, choose the other program and select Connect store.
- On Choose a website, choose the website and select Connect website.
Check the connection
Run these in your Magento root directory.bin/magento loyaltylion:report reports in to LoyaltyLion now, as the hourly job does, and prints what it sent. LoyaltyLion offers your store only the features the module last reported it can do, so run it after an install or an upgrade. setup:upgrade reports in too, once the website is connected. In answer_by_website, each connected website’s ID has LoyaltyLion’s answer:
200: LoyaltyLion accepted the report.401or403: LoyaltyLion refused the website’s API key. Check the API key setting.0: the store couldn’t reach LoyaltyLion.
bin/magento loyaltylion:outbox:send sends what’s waiting now, as the job does each minute, and prints:
sent_now: how many orders and customers met each outcome in this run, such assent,retryorheld.waiting: how many are still to be sent.parked: how many LoyaltyLion refused.oldest_waiting_at: when the oldest waiting one was noted.
bin/magento loyaltylion:outbox:retry-parked queues the parked orders and customers again. Run it once you’ve put right what LoyaltyLion refused them for, such as a wrong Site ID. Add --website <id> to queue one website’s only. Waiting, held and parked explains each state.
The module logs what it couldn’t do in the store’s log, with lines that start [LoyaltyLion].