cancel
Showing results for 
Search instead for 
Did you mean: 

Configurable Product (package size eg. 1kg, 2kg) how to decrease stock according to that?

Configurable Product (package size eg. 1kg, 2kg) how to decrease stock according to that?

Hello 

 

I sell food which I have in stock in let's say 200kg. Now the customer can buy 1kg, 2kg, 5kg, 10kg. It's the same food just in different package sizes. (But they are not pre-packed, they are packed in the right size as soon as someone orders)

 

Therefore I created a configurable product based on the XY kilogramms (kg). Now I would like my shop to decrease the stock on the main product (which represents the total in kilogramms as qty) in the by it's package size (eg. 1, 2, 5 or 10)...

 

I hope it's understandable what I mean. If not, please ask.

How can I achieve that?

3 REPLIES 3

Re: Configurable Product (package size eg. 1kg, 2kg) how to decrease stock according to that?

Hello @patrick_tschumi 

 

Magento provides decimal qty.

https://stackoverflow.com/questions/16966354/magento-decimal-quantity-stock-management 

 

I thought you should transfer your configurable product to a simple product and allow decimal qty as well.

Create one attribute for this type of product like consider qty as weight.

 

By decimal, qty customers can buy your product like 1.5 qty ( 1.5 kg ).

By using a new attribute you can change the label to Enter weight on product page near qty box.

 

So you no need to manage different stock you can create a packet according to customer order.

 

It will also help you with shipping charges.

 

----

Problem solved: Click on Accept as Solution

 

Thank you

Hiren Patel

Re: Configurable Product (package size eg. 1kg, 2kg) how to decrease stock according to that?

Hi @Hiren_K_Patel 

 

That's also a good idea but not exactly what I want. I found a module which is doing what I want + some extras, but unfortunatly I get errors...


Fatal error: Uncaught Error: Cannot instantiate interface Aitoc\ProductUnitsAndQuantities\Api\RealProductPuqConfigRepositoryInterface in public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121 Stack trace: #0 /public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Aitoc\\ProductUn...', Array) #1 /public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create('Aitoc\\ProductUn...') #2 /public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get('Aitoc\\ProductUn...') #3 /public_html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create('Aitoc\\ProductUn...') #4 /public_html/vendor/magento/framework/ObjectManager/ in /public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

 

Has anybody an idea why this is happening?

 

Regards

Patrick

Re: Configurable Product (package size eg. 1kg, 2kg) how to decrease stock according to that?

Hi @patrick_tschumi ,

 

This is compile error try following commands

> rm -rf var/cache/* var/generation/* generated/*

> php bin/magento setup:upgrade

> php bin/magento setup:di:compile -vvv

> php bin/magento setup:static-content:deploy 

> chmod -R 777 var pub generated

 

If you like my answer then click on Kudos

 

Problem solved - click on Accept as Solution

 

Hiren Patel