Skip to content

Magento 2 Customer Group Prices Manual

Customer Group Prices

Magento 2 Customer Group Prices allows the store owner to specify distinctive product prices for different customer groups. This opens new opportunities for the store owners to fulfil their needs. One of such business cases is setting different prices for the logged-in and not logged-in customers. With this extension, the store owner can run more targeted marketing, deploy various pricing strategies, engage the customers in certain activities and more. The extension lets the store owner set this type of the price for each group and display it as a regular one, without crossing and mentioning the original product one.

By means of this extension, the price can be specified for every customer group on the product level (all major Magento 2 product types are supported). Due to the great scalability, an unlimited number of products, customers, and customer groups are easily supported.

On the frontend, these prices can be shown not only on the product pages, but on any layered navigation page and on the search results pages as well.

Requirements and Installation

Customer Group Prices supports Open source (Community), Commerce (Enterprise) editions and Commerce cloud. The current version of the Magento installed on your website can be found in the lower right corner of any backend page.

Customer Group Prices has 3 separate ways of installation:

1) Copy the code (ready-to-paste package);
2) Use MageWorx Repository;
3) Use local Composer.

Extension Configuration

Backend Setup

Log into the Magento Admin panel and go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Customer Group Prices.

group prices

The Enabled Customer Group Prices setting provides the possibility to temporary disable/re-enable the extension functionality from the backend.

If the Used Group Price in Catalog Price Rule is enabled, the special prices will be automatically set in any cart/catalog price rules.

Customer Group Price Configuration

The extension extends the default customer groups configuration. It enables the possibility to set fixed/percentage surcharges or discounts for the targeted customer groups. Go to CUSTOMERS ⟶ Customer Groups and click any group or create the new group by hitting the Add New Customer Group button.

group prices

The extension adds two extra settings: Group Price and Price Type.

The Group Price field allows to set the numerical value for the discount or surcharge. The minus sign is used for the discounts while the plus is for the surcharges. The type of these discounts/surcharges is handled by the Price Type setting. It can be either Fixed or Percent.

To give the $10 surcharge to the customers for all the products, the store owner needs to put the +10 in the Group Price field and select the Fixed value in the Price Type setting.

To give the 5% discount, the store owner should put -5 and Percent.

Group Prices on the Product Level

The store owner can specify the group prices on the product level as well. This may be important for the refined, granular product pricing. If the price is specified for the customer group and the product, the product’s price will be shown. To modify the desired group prices, the store owner should go to CATALOG ⟶ Products and select the desired product or create the new one by clicking the Add Product button.

group prices

Click the Advanced Pricing link. The popup will be shown.

group prices

The extension adds the Group Price and Special Group Price. The first one modifies the product’s price, the second one edits the special price. In Magento 2, the special price appears instead of the regular price, followed by a notation that shows the regular one.

group prices

To add the new group price or special group price the store owner should click the Add button. The grid contains the columns that allow to select the desired Website and the Customer group. The Price field allows to set the numerical value for the discount or surcharge. The minus sign is used for the discounts while the plus is for the surcharges. The type of these discounts/surcharges is handled by the Price Type setting. It can be either Fixed or Percent.

When the edits are ready, click the Done button and then Save the product.

Customer Group Prices Import/Export

The extension has the possibility to export the cusotmer group prices and to import them. Log into the Magento Admin panel and go to SYSTEM ⟶ Data Transfer ⟶ Import and Export Customer Group Prices.

File Downloads Sections Configuration

To check the structure of the CSV document, click the Export button or the Download Example CSV.

The structure of the CSV is as follows:

"Product SKU","Website ID","Group Name/ID"," Group Price","Group Special Price"
"24-MB06","1","Wholesale","20","18"
"24-MB06","1","Retailer","-15","-10"
"24-MB01","1","Retailer","-25%","20%"

Each line has only one SKU. The Group Price and Group Special Price share the same logic that we've already described : fixed values, fixed discounts, percent values and percent discounts.

If you have our Magento 1 Customer Group Prices, you can export the data from Magento 1 and then import the CSV file to Magento 2 installation. For this, log into the Magento 1 admin panel and go to System ⟶ Import/Export ⟶ Customer Group Prices ⟶ Export Prices. The Value delimiter should be , and for the Enclose Values In put ".

File Downloads Sections Configuration

It should export 2 files: one for prices, another one - for special prices. Check the exported files on the server. You need to upload the exported CSVs to the corresponding fields in the Magento 2 installation. For the upload of the CSV files, click the Choose File button near the Import Group Price from Magento 1 and Import Special Group Price from Magento 1 , select the CSV files and click Import.

API

Get Product Customer Group Prices

The method needs the admin authorization token.

Magento returns all active product group prices for the specified list of SKUs.

Request Format

POST /index.php/rest/default/V1/products/mw-group-prices-information

Payload

{
  "skus": [
    "24-MB01"
  ]
}

Response JSON example

[
    {
        "group_name": "General",
        "price": "11",
        "sku": "24-MB01",
        "website_id": 1,
        "price_type_code": "fixed"
    }
]

Delete Product Group Prices

The method needs the admin authorization token.

You must specify each product group price that should be be deleted. You can delete multiple product group prices in a single call.

Request Format

POST /index.php/rest/default/V1/products/mw-group-prices

Payload

{
  "prices": [
    {
        "group_name": "Retailer",
        "price": "20",
        "sku": "24-MB03",
        "website_id": 2,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[] (an empty array)

Update (or Create) Product Group Prices

The method needs the admin authorization token.

You can set or update existing product group prices.

Request Format

POST /index.php/rest/default/V1/products/mw-group-prices

Payload

{
  "prices": [
    {
        "group_name": "Retailer",
        "price": "20",
        "sku": "24-MB03",
        "website_id": 2,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[
    {
        "group_name": "General",
        "price": "11",
        "sku": "24-MB01",
        "website_id": 1,
        "price_type_code": "fixed"
    }
]

Replace Product Group Prices

The method needs the admin authorization token.

The 'replace' request removes all existing product group prices for a specified product and adds new rows for the same product instead.

Request Format

PUT /index.php/rest/default/V1/products/mw-group-prices

Payload

{
  "prices": [
    {
        "group_name": "NOT LOGGED IN",
        "price": "-20",
        "sku": "24-MB04",
        "website_id": 3,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[] (an empty array)

Get Product Group Special Prices

The method needs the admin authorization token.

Magento returns all active product group special prices for the specified list of SKUs.

Request Format

POST /index.php/rest/default/V1/products/mw-group-special-prices-information

Payload

{
  "skus": [
    "24-MB05"
  ]
}

Response JSON example

[
    {
        "group_name": "NOT LOGGED IN",
        "price": "-20",
        "sku": "24-MB05",
        "website_id": 0,
        "price_type_code": "fixed"
    },
    {
        "group_name": "General",
        "price": "+30",
        "sku": "24-MB05",
        "website_id": 1,
        "price_type_code": "percent"
    }
]

Delete Product Group Special Price

The method needs the admin authorization token.

You should specify each product group special price that should be deleted. You can delete multiple product group special prices in a single call.

Request Format

POST /index.php/rest/default/V1/products/mw-group-special-prices-delete

Payload

{
  "prices": [
    {
        "group_name": "NOT LOGGED IN",
        "price": "-4",
        "sku": "24-MB05",
        "website_id": 1,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[] (an empty array)

Replace Product Group Special Prices

The method needs the admin authorization token.

The 'replace' request removes all existing product group special prices for a specified product and adds new rows for the same product instead.

Request Format

PUT /index.php/rest/default/V1/products/mw-group-special-prices

Payload

{
  "prices": [

    {
        "group_name": "NOT LOGGED IN",
        "price": "400",
        "sku": "24-MB06",
        "website_id": 1,
        "price_type_code": "fixed"
    },
    {
        "group_name": "General",
        "price": "200",
        "sku": "24-WB01",
        "website_id": 2,
        "price_type_code": "percent"
    },
    {
        "group_name": "Wholesale",
        "price": "100",
        "sku": "24-WB02",
        "website_id": 2,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[] (an empty array)

Get Customer Group Prices

The method needs the admin authorization token.

This method returns all active customer group prices for the specified list of Customer Groups.

Request Format

POST /index.php/rest/default/V1/customerGroups/mw-group-prices-information

Payload

{
  "ids": [
    "1"
  ]
}

Response JSON example

[
    {
        "group_id": 1,
        "price": "-50",
        "website_id": 0,
        "price_type_code": "percent"
    }
]

Delete Customer Group Prices

The method needs the admin authorization token.

You need to specify each customer group price that should be deleted. You can delete multiple customer group prices in a single call.

Request Format

POST /index.php/rest/default/V1/customerGroups/mw-group-prices-delete

Payload

{
  "prices": [
        {
            "group_id": 0,
            "website_id": 0,
            "price": "50",
            "price_type_code": "fixed"
        },
        {
            "group_id": 3,
            "price": "100",
            "website_id": 0,
            "price_type_code": "percent"
        },
        {
            "group_id": 1,
            "price": "-66",
            "website_id": 0,
            "price_type_code": "percent"
        }
    ]
}

Response JSON example

[] (an empty array)

Update (or Create) Customer Group Prices

The method needs the admin authorization token.

You can set or update existing customer group prices.

Request Format

POST /index.php/rest/default/V1/customerGroups/mw-group-prices

Payload

{
  "prices": [
    {
        "group_id": 2,
        "price": "-50",
        "website_id": 0,
        "price_type_code": "percent"
    },
    {
        "group_id": 3,
        "price": "20",
        "website_id": 1,
        "price_type_code": "fixed"
    }
  ]
}

Response JSON example

[] (an empty array)

Replace Customer Group Prices

The method needs the admin authorization token.

This request removes all existing customer group prices for a specified customer group and adds new rows for the same group instead.

Request Format

PUT /index.php/rest/default/V1/customerGroups/mw-group-prices

Payload

{
  "prices": [
    {
        "group_id": 2,
        "price": "115",
        "website_id": 0,
        "price_type_code": "fixed"
    },
    {
        "group_id": 3,
        "price": "-20",
        "website_id": 0,
        "price_type_code": "percent"
    }
  ]
}

Response JSON example

[] (an empty array)

We prepared the Postman collection file with all API requests for easier usage. Click here to download.

Got Questions?

Need help with the extensions? Feel free submit a ticket from https://www.mageworx.com/support/ 



Mageworx offers outstanding services developing custom-tailored solutions for Magento platform to attain your eCommerce objectives. Our professional impassioned team provides profound and custom oriented development of your project in a short timeframe.