Zend certified PHP/Magento developer

Difference admin save and cli script save?

Background: Some products option detail (e.g. text field data) is not correctly held through the process… User enters data on the product page and it is missing in the basket page. A simple fix is to save the product in the admin (no changes)… so am building a script to save all products with product options.

Problem: The script isn’t fixing the problem, so it is not performing the same actions as the admin save with the GUI. Why?

Here is my script:

require __DIR__ . '/app/bootstrap.php';

$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('adminhtml');

$arrProductIDs = [...];

foreach ($arrProductIDs as $iProductID) {
    $product = $objectManager->create('MagentoCatalogModelProduct')->load($iProductID);
    $product->save();
    echo $iProductID.' saved - ';
}

I have also tried changing some data a little, but no better:

$desc_orig = $product->getDescription();
$product->setDescription($desc_orig.' ');

Can anyone please help me understand fix this so that I can replicate going into the admin and saving all of these products?