0

How can i set the salable quantity value as No manage Stock in magento 2.3.3 https://prnt.sc/xcehjd

1 Answer 1

0

If you want to do this for all products using a script file from the root then you can use this.

Create a script.php file in your Magento root directory

<?php
use Magento\Framework\App\Bootstrap;
require 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);

$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
/*--------------------------------------------------------------------------*/
$productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');

$collection = $productCollectionFactory->create();

foreach ($collection as $key => $product) {
        $product->setStockData(array( 
                    'use_config_manage_stock' => 0,
                    'is_in_stock' => 1, 
                    'qty' => 100,
                    'manage_stock' => 0,
                    'use_config_notify_stock_qty' => 0
                )); 
        $product->save();
}
1
  • Hi, how can I set salable quantity to match quantity per source or keep it in stock? Commented Mar 17, 2023 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.