Skip to content

ElasticSearch Plugin - Multi-vendor stores need the ability to groupBySKU and not just groupByProduct #3

@LeftoversTodayAppAdmin

Description

@LeftoversTodayAppAdmin

Describe the bug
In multi-vendor stores, different vendors can create the same product in their channel (ex. Oreo cookies) with the same SKU (Ex. barcode). We need to do this to allow each vendor to independently manage their own product, stock levels etc. and we cannot create a product in the default channel and assign it to multiple vendor channels as they will share stock levels etc.

In the above scenario, each product has its own productId and productVariantId and groupByProduct does not do anything. If we want to get a unique list of all the products grouped by their SKU (barcode) then we need a new groupBySKU option for ElasticSearch.

To Reproduce
Steps to reproduce the behavior:

  1. Create the same product with the same SKU (Ex. barcode), lets stay it represents a box of Oreo Cookies, in multiple channels in a multi-vendor setup
  2. Each time a new product entity is created it gets a new autogenerated id based on the ID strategy
  3. groupByProduct then collapses the search result by productId which is unique resulting in no collapse at all
  4. There is no groupBySKU to get a distinct list of items across all vendors sicen they all have their own product to manage their own stock etc.

Expected behavior
A groupBySKU option is available in the ElasticSearch plugin allowing multi-vendor stores to get a distinct list of products by SKU across all vendors

Environment (please complete the following information):

  • @vendure/core version: 3.2
  • Nodejs version: 20
  • Database (mysql/postgres etc): mysql

Additional context
Add any other context about the problem here.

groupByProduct was added in these checkins:
vendurehq/vendure#1018
vendurehq/vendure@27994d8

Visual representation:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    elasticsearch-pluginRelated to the elasticsearch-plugin packageenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions