> ## Documentation Index
> Fetch the complete documentation index at: https://developers.loyaltylion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrade the Magento 2 module from 1.x

> [!WARNING]
>
> This page describes version 2.0 of the LoyaltyLion module for Magento 2, which
> isn't released yet, and applies from the 2.0 release. Until then, install the
> current module by following [Adobe Commerce
> 2](https://developers.loyaltylion.com/docs/installation/adobe-commerce-2.md).

Version 2.0 of the LoyaltyLion module replaces 1.x in place, from the same Composer package, `loyaltylion/core`. This page lists what to do when you upgrade, and what changes for your shoppers and your program.

Module 2.0 needs Magento Open Source 2.4.4 or later and PHP 8.1 or later. [Install and connect](https://developers.loyaltylion.com/docs/installation/magento-2/install.md#requirements) lists everything it supports.

## Before you upgrade

* **Try the upgrade on a staging copy of your store.** Several parts of your program show on the storefront from the moment the upgrade runs. See [What shoppers see](#what-shoppers-see) and decide which to turn off.
* **Check custom code that reads LoyaltyLion's customer data section.** It's renamed from `lion-customer` to `loyaltylion-shopper`. Update any theme or custom code that reads the old name.
* **Check the purchase rule's Award points for tax.** How an order earns points changes. See [Points and rewards](#points-and-rewards).

## Upgrade

**1. Update the module**

In your Magento root directory, as the user that owns your Magento files:

```sh theme={null}
composer require loyaltylion/core:^2.0
bin/magento setup:upgrade
```

If your store runs in production mode, follow with your usual deployment steps, such as `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy`.

**2. Check cron**

The module's jobs now run in a cron group of their own, `loyaltylion`. A store that runs Magento's standard `bin/magento cron:run` needs nothing more. If your crontab runs named groups only, add the `loyaltylion` group, or orders and customers stop reaching LoyaltyLion. See [Check cron](https://developers.loyaltylion.com/docs/installation/magento-2/install.md#check-cron).

**3. Approve the integration again**

Module 2.0 asks Magento for a different set of resources, and Magento withdraws its approval of an integration whose resources change. Until you approve it again, LoyaltyLion can't create reward codes in your store.

In Magento admin, go to **System > Extensions > Integrations** and select **Reauthorize** next to LoyaltyLion. Allow the resources, and Magento opens LoyaltyLion in a new window.

**4. Connect the store**

On **Connect your store**, choose your program and select **Connect store**. If your store has more than one website, choose the website and select **Connect website**.

Module 2.0 connects each website with four settings in place of 1.x's token and secret: Site ID, Site token, API key and SDK secret token. When your store's address matches the program's **Store URL** in LoyaltyLion, connecting saves all four in the website for you. Otherwise, enter them under **Stores > Configuration > LoyaltyLion > Connection**, as [Enter the settings yourself](https://developers.loyaltylion.com/docs/installation/magento-2/install.md#enter-the-settings-yourself) describes.

**5. Check the connection**

Run `bin/magento loyaltylion:report`. Each connected website should answer `200`. Then run `bin/magento loyaltylion:outbox:send`, which sends any orders and customers that waited during the upgrade. [Check the connection](https://developers.loyaltylion.com/docs/installation/magento-2/install.md#check-the-connection) explains what both print.

### Between the upgrade and the new settings

Until a website has its new settings, the storefront keeps working on 1.x's token and secret. The module keeps the website's orders and customers, and sends them once the Site ID and API key are entered. Magento admin shows a system message naming each website that still needs its Site ID, API key and SDK secret token.

## What shoppers see

These storefront settings are on by default after the upgrade. Review them under **Stores > Configuration > LoyaltyLion > Connection**, at website scope, and turn off any you don't want.

* **Show the loyalty page**: a loyalty page at `/loyalty`. A CMS page of your own at the same address is shown instead.
* **Show Rewards in the customer's account**: a **Rewards** page in the account menu.
* **Show LoyaltyLion on the checkout's payment step**: a place for LoyaltyLion's block on the payment step.
* **Show LoyaltyLion on the order confirmation page**: LoyaltyLion's block on the order confirmation page.

[On your storefront](https://developers.loyaltylion.com/docs/installation/magento-2/how-it-works.md#on-your-storefront) describes each setting.

Other changes:

* **Claimed codes can go onto the cart by themselves.** After the upgrade, a shopper still pastes a claimed reward code or referral code into the cart. To have codes go on by themselves, set **How voucher codes are applied** to **Automatic** on the **Reward settings** page in LoyaltyLion. A Magento Open Source cart holds one coupon code at a time, so a code applied this way replaces one the shopper entered.
* **Check Out with Multiple Addresses isn't available while the cart holds a free product reward.** The shopper uses the standard checkout instead.
* **Referral discounts keep their old label.** At checkout, a referral discount created before the upgrade reads "Automatically generated by LoyaltyLion - do not modify". Referral discounts created after it read "Referral discount".

## Points and rewards

* **What an order earns points on.** With 1.x, an order earned on the amount paid minus shipping, so tax always earned points. With 2.0, each line earns on its own price, and tax earns points only when your purchase rule's **Award points for tax** is on. Tax on shipping doesn't earn points. If your program has **Award points for tax** off, each order earns fewer points than before, so check the setting before you upgrade, and tell your members if what they earn changes.
* **Product points apply.** Orders now carry their lines, so bonus points and points modifiers for products and categories apply to them.
* **Reward codes have discount combinations.** Each reward has **Priority** and **Discard subsequent rules** under **Discount combinations** on its form in LoyaltyLion. A reward keeps priority 0 with **Discard subsequent rules** on, as its codes had before. See [Discount combinations](https://developers.loyaltylion.com/docs/installation/magento-2/discount-combinations.md).

## Behind the scenes

* **Orders, customers and refunds are sent from your store.** The module queues each change and sends it with retries, where 1.x sent each once. LoyaltyLion no longer reads your store's orders every hour.
* **Each member's tier is written to their customer.** The `loyaltylion_tier` customer attribute holds the tier's name. Shoppers don't see it.
* **New commands.** `bin/magento loyaltylion:report` reports in to LoyaltyLion, `loyaltylion:outbox:send` sends what's waiting, and `loyaltylion:outbox:retry-parked` sends again the orders and customers LoyaltyLion refused, once you've corrected the cause, such as a wrong Site ID. [Check the connection](https://developers.loyaltylion.com/docs/installation/magento-2/install.md#check-the-connection) explains each.
