diff --git a/controllers/StockApiController.php b/controllers/StockApiController.php index b04640c3..16ad51f4 100644 --- a/controllers/StockApiController.php +++ b/controllers/StockApiController.php @@ -583,6 +583,18 @@ class StockApiController extends BaseApiController try { $args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']); + + if (Grocycode::Validate($args['barcode'])) + { + $gc = new Grocycode($args['barcode']); + if ($gc->GetExtraData()) + { + $requestBody = $request->getParsedBody(); + $requestBody['stock_entry_id'] = $gc->GetExtraData()[0]; + $request = $request->withParsedBody($requestBody); + } + } + return $this->OpenProduct($request, $response, $args); } catch (\Exception $ex)