Magento 2 Product Shelf Life

Installation and User Guide for Magento 2 Product Shelf life Extension

Table of Contents

  1. Installation
    • Installation via app/code
    • Installation via Composer
  2. Configuration Settings for Product Shelf Life Expiration
    • General Settings
    • Batch Settings
    • Product Batches Grid
    • Add Sources at Product Level
    • Add New Product Batch
    • Un-Associate / Delete Product Batch
    • Product Batches at Product Level
    • Add Specific Batch to Product
    • Select Batches During Shipment
    • Batch Details on the Order View Page
    • Deleting or Un- Associating a Product Batch
    • Deleting
    • Un-Associating
    • Batch Report
    • Import / Export Product Batches
    • Batch Expiration Email Notification
  3. API - Application Programming Interface
    • Authentication Token
    • Creating a Batch using API
    • Retrieve all Batches using API
    • Retrieve Date of Batch using ID 1 Using API
    • Delete Batch with ID 1 Using API

Installation

https://docs.scommerce-mage.com/magento-2-extensions/installation-via-composer/installation-via-composer

Configuration Settings for Product Shelf Life Expiration

Go to Admin > Stores > Configuration > Scommerce Configuration > Product Shelf Life Expiration

General Settings

image (51).jpg

Batch Settings

image (52).jpg

image (53).jpg

Product Batches Grid

You can create and manage product batches from, Admin> Product Batches. This grid will have all the details about batches like ID, Batch Code, Product SKU, Batch Status, Batch Qty, Batch Expiry, Action/Edit and Source Inventory.

image (69).png

image (70).png

image (54).jpg

image (55).jpg

Product Batches at Product Level

When user enables the module then Product Batches section appears at, Admin>Catalog>Product>Select Product>Edit>Product Batches. From this section, users can add new batch or can associate specific existing batch to a product.

image (71).png

Add Specific Batch to Product

You can also add specific batches to a product from, Admin > Catalog > Product > Select Product >Edit >Product Batches >Click"Add Specific Batch". It redirects to Batch Grid and by selecting batch ID you can associate active batches to a product.

image (72).png

image (31) (1).png

image (73).png

Deleting or Un- Associating a Product Batch

Note:- If an order has been shipped then you won't be able to delete that product batch. You will see an error.

image (32) (1).png

image (33) (1).png

Note:- If an order has been shipped then you won't be able to delete that product batch. You will see an error.

image (35) (1).png

Import / Export Product Batches

To import and export product batches, go to Admin > System >Import / Export.

Import Settings

image (56).jpg

CSV File Format for Import - CSV file will have batch_code, batch_qty, batch_status, batch_expiry, product_sku and source_inventory.

image (74).png

Export Settings

image (36) (1).png

image (75).png

API - Application Programming Interface

Authentication Token

auth_token can be received using the following: -

You would need credentials to your store with admin rights Parameters:-.Admin credentials

POST URL:- http://baseurl/index.php/rest/V1/integration/admin/token Content-Type: application/json

{

"username": "admin", "password": "admin"

}

Creating a Batch using API

Parameters:-

POSTURL:-http://baseurl/index.php/rest/V1/productbatches/createbatch Content-Type: application/json

Authorization: Bearer {{auth_token}}

{

"batch_code": "batchcode_001", "batch_qty": "10",

"batch_status": "1",

"batch_expiry": "2020-12-06", "product_sku": "MH0001"

}

Retrieve all Batches using API

Parameters:-

Authorization token

GET URL:-http://baseurl/index.php/rest/V1/productbatches/getcollection Content-Type: application/json

Authorization: Bearer {{auth_token}}

Retrieve Date of Batch using ID 1 Using API: -

Parameters: -

GET URL:-http://baseurl/index.php/rest/V1/productbatches/getbatch?batchId=1 Content-Type: application/json

Authorization: Bearer {{auth_token}}

Delete Batch with ID 1 Using API: -

Parameters: -

PUT URL: - http://baseurl/index.php/rest/V1/productbatches/deletebatch Content-Type: application/json

Authorization: Bearer {{auth_token}}

{

"batchId": 1

}

If you have a question related to this extension please check out our FAQ Section first. If you can't find the answer you are looking for then please contact support@scommerce-mage.com.


Revision #4
Created 30 May 2025 11:49:33 by scommerce
Updated 24 October 2025 10:04:20 by scommerce