PHPackages                             aashan/module-link-guest-orders - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. aashan/module-link-guest-orders

ActiveMagento2-module[Authentication &amp; Authorization](/categories/authentication)

aashan/module-link-guest-orders
===============================

Links guest orders to customer accounts if there is any user account associated with the order email.

v1.0.5(1y ago)35.6k↓33.3%21PHP

Since Oct 15Pushed 1y agoCompare

[ Source](https://github.com/aashan10/magento2-link-guest-order)[ Packagist](https://packagist.org/packages/aashan/module-link-guest-orders)[ RSS](/packages/aashan-module-link-guest-orders/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (5)Used By (1)

[![Build Status](https://camo.githubusercontent.com/90f5d6f5e3537fd2d736a16d1e235986571410e3e65153aa6e0265466158fa53/68747470733a2f2f7472617669732d63692e636f6d2f61617368616e31302f6d6167656e746f322d6c696e6b2d67756573742d6f726465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/aashan10/magento2-link-guest-order)

Link Guest Customer
-------------------

[](#link-guest-customer)

- [ Overview ](#overview)
- [ Installation ](#overview)
    - [ Composer Installation ](#composer-installation)
    - [ Manual Installation ](#manual-installation)
    - [ Install via Git ](#install-via-git)
- [ API ](#api)
- [ Contributing ](#contributing)

### Overview

[](#overview)

By default, Magento 2 doesn't automatically link the guest orders as customer orders if the account with email supplied during the checkout process already exists. That is where this module comes in handy. This module automatically synchronizes the orders on the basis of order email address. You can even sync previously added orders through the admin panel.

[![Image](https://camo.githubusercontent.com/4ed2318d5550c245b44f262fbc23add7fd8665b5ea9d1f3cdce7402b1bad0baa/68747470733a2f2f692e696d6775722e636f6d2f666b4a415476722e706e67)](https://camo.githubusercontent.com/4ed2318d5550c245b44f262fbc23add7fd8665b5ea9d1f3cdce7402b1bad0baa/68747470733a2f2f692e696d6775722e636f6d2f666b4a415476722e706e67)[![Image](https://camo.githubusercontent.com/a77f01d882e296e8fd4a90a8d8c43de588c1b24edd1f24f7dcae9ea98be833c8/68747470733a2f2f692e696d6775722e636f6d2f633058484775512e706e67)](https://camo.githubusercontent.com/a77f01d882e296e8fd4a90a8d8c43de588c1b24edd1f24f7dcae9ea98be833c8/68747470733a2f2f692e696d6775722e636f6d2f633058484775512e706e67)[![Image](https://camo.githubusercontent.com/297eff458ea57356fe83da867cff89a95719080dce3fe90a01fc493e5a279fae/68747470733a2f2f692e696d6775722e636f6d2f6c564a724e34562e706e67)](https://camo.githubusercontent.com/297eff458ea57356fe83da867cff89a95719080dce3fe90a01fc493e5a279fae/68747470733a2f2f692e696d6775722e636f6d2f6c564a724e34562e706e67)

### Installation

[](#installation)

- #### Composer Installation

    [](#composer-installation)

    Inside your project root directory, run `composer require aashan/module-link-guest-orders`.

    Make sure to run post installation scripts.
- #### Manual Installation

    [](#manual-installation)

    This module can be installed by downloading the latest release and extracting the files under `/app/code/Aashan/LinkGuestOrder`. Once the files have been extracted, run the post installation scripts.
- #### Install via Git

    [](#install-via-git)

    To install it via git, follow the following process.

    - `cd  `
    - `mkdir app/code/Aashan/LinkGuestOrder && cd app/code/Aashan/LinkGuestOrder`
    - `git init`
    - `git remote add origin https://github.com/aashan10/magento2-link-guest-order.git`
    - `git pull origin master`

    Once the installation is complete, please follow post installation scripts.
- #### Post Installation

    [](#post-installation)

    Once you have your module installed by one of the above methods, run the following commands to make sure that the module is setup correctly.

    - `bin/magento setup:upgrade`
    - `bin/magento cache:clean`

### API

[](#api)

The module provides a simple API for auto linking the orders to their respective customers. The main API is available through `Aashan\LinkGuestOrder\Helper\OrderLinkHelper` helper class. It consists of a method `linkOrderToCustomer` which takes object of `Magento\Sales\Model\Order` class as the only argument.

Below is an example on using the API.

```
