Magento 2 Product Shelf Life
Last updated
Was this helpful?
Last updated
Was this helpful?
Table of Contents
Installation via app/code
Installation via Composer
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
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
Update Batch with Batch Code 'xyz' Using API
Update Batch with Batch ID 'xyz' Using API
Installation via app/code: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory.
Installation via Composer: Please follow the guide provided in the below link to complete the installation via composer.
Go to Admin > Stores > Configuration > Scommerce Configuration > Product Shelf Life Expiration
Enabled - Select “Yes” or “No” to enable or disable the module.
Batch expiry email notification period (number of days) - Please define batch expiry email notification period. This setting will check the batch expiry date and will send an email notification to the admin for the same.
Batch expiry email notification (Yes/No) - Please select “Yes” or “No” to “Enable” or “Disable” the email notification regarding batch expiration.
Disable batch once expired - Please select “Yes” or “No” to disable the batch. It disables the batch automatically once their expiry date is passed and runs as part of cron job at midnight.
Email Addresses - Please provide email addresses (comma separated) to send the batch expiration email notification.
Email Sender – Please select sender/ from email addresses for Batch expiry updated.
Select Email Template -Please select the email template for batch expiry email notification.
Cron Scheduler for expiry batch notification - This setting will be used to send the email through the cron.
Batch Selection Attribute – This setting will determine how batches are selected automatically.
Batch Selection Attribute Direction – As per the batch selection attribute you can choose the direction for example Ascending(ASC) or Descending(DSC).
Batch Selection – You can choose to select batches automatically based on batch selection attribute or you can set it to Manual. When Manual you will be able to select batches during shipment.
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.
Add Sources at Product Level -You can add product source from Admin > Catalog > Select Products > Click "Assign Sources"> Select "Source"> Click "Done" .
Add New Product Batch -To create new product batch, go to Admin > Product Batches>click 'Add New Batch'. It will take you to the new product batch page and by providing all the required details; you can create the new batch.
Un-Associate / Delete Product Batch -Toun-associate and delete product batch, go toAdmin > Product Batches> Select Batch > Edit >Click "Un-Associate with Product'' and for Delete click on "Delete" button.
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.
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.
Select Batches During Shipment -To select the batch during shipment make sure Batch Selection is set to manual in the configuration then navigate to Admin> Sales > Order > Select Order > View>Generate Invoice>Click on Ship. When you scroll down on the page you will see the option to select the batches manually. The product quantity will be deducted from the selected batch. Please refer to the image below:-
Batch Details on the Order View Page -To view theproduct batch related details, go to Admin > Sales > Order > Select Order > View.
Deleting: -To delete a product batch, go to Catalog>Product Batches then select the product batch that you want to delete. From Action coloumn click Edit. Here you will see the option to delete the Product batch.
Un-Associating:- To Un-Associate a product batch, go to Catalog>Product Batches then select the product batch that you want to delete. From Action column click Edit. Here you will see the option to Un-Associate the Product batch.
Batch Report:- To view the detailed batch report go to your admin panel then Reports>Sales>Batches. Here you can see all the orders associated with a product batch with the following information:-
Order Number
Purchase Date
Customer
Customer Group
Product Name
Batch code
Batch Quantity
Expiry Date
To import and export product batches, go to Admin > System >Import / Export.
Import - It updates the stock quantity and disables the batches if they are expired.
Export-It exports the batches in the selected file format, e.g. CSV.
CSV File Format for Import - CSV file will have batch_code, batch_qty, batch_status, batch_expiry, product_sku and source_inventory.
Batch Expiration Email Notification - When you select "Yes" for "Batch expiry email notification"from Admin > Stores > Configuration > Scommerce Configuration > Product Shelf Life Expiration > Batch Settings, then it sends an email notification for batch expiration.
You would need credentials to your store with admin rights Parameters:-.Admin credentials
Username
Password
{
"username": "admin", "password": "admin"
}
Authorization token received from the above step
Batch code
Batch quantity
Batch status
Batch expiry
Product SKU
Authorization: Bearer {{auth_token}}
{
"batch_code": "batchcode_001", "batch_qty": "10",
"batch_status": "1",
"batch_expiry": "2020-12-06", "product_sku": "MH0001"
}
Authorization token
Authorization: Bearer {{auth_token}}
Authorization token
Batch ID in URL
Authorization: Bearer {{auth_token}}
Authorization token
Batch ID
Authorization: Bearer {{auth_token}}
{
"batchId": 1
}
Authorization token
Batch Qty
Batch Status
Batch_expiry
Product_sku
You can several other parameters that you want to update.
POST URL:- http://baseurl/index.php/rest/V1/productbatches/updatebatchByCode/{{batch_code}}
Content-Type: application/json
Authorization: Bearer {{auth_token}}
{
"batch_qty": "10",
"batch_status": "1",
"batch_expiry": "2020-12-06",
"product_sku": "MH0001"
}
Authorization token
Batch Qty
Batch Status
Batch_expiry
Product_sku
You can several other parameters that you want to update.
POST URL:- http://baseurl/index.php/rest/V1/productbatches/updatebatchById/{{batch_ID}}
Content-Type: application/json
Authorization: Bearer {{auth_token}}
{
"batch_qty": "10",
"batch_status": "1",
"batch_expiry": "2020-12-06",
"product_sku": "MH0001"
}
License Key –Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at .
POST URL:- Content-Type: application/json
POSTURL:- Content-Type: application/json
GET URL:- Content-Type: application/json
GET URL:- Content-Type: application/json
PUT URL: - Content-Type: application/json
If you have a question related to this extension please check out our first. If you can't find the answer you are looking for then please contact .