Skip to content

Commit

Permalink
feat: set scan identifier as first barcode
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed May 31, 2022
1 parent 29944f3 commit bc74a90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ecommerce_integrations/unicommerce/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ def _build_unicommerce_item(item_code: ItemCode) -> JsonDict:
item_json["enabled"] = not bool(item.get("disabled"))

for barcode in item.barcodes:
if not item_json.get("scanIdentifier"):
# Set first barcode as scan identifier
item_json["scanIdentifier"] = barcode.barcode
if barcode.barcode_type == "EAN":
item_json["ean"] = barcode.barcode
elif barcode.barcode_type == "UPC-A":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"categoryCode": "Products",
"name": "TITANIUM WATCH",
"description": "This is a watch.",
"scanIdentifier": "TITANIUM_WATCH",
"scanIdentifier": "73513537",
"length": 100,
"width": 100,
"height": 50,
Expand Down

0 comments on commit bc74a90

Please sign in to comment.