0

I have to update and checked checkbox for use default field for product status. But I do not know how to update and checked that checkbox ? enter image description here here is my code

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

        $productId = 1;
        $status = 1;
        $store = 1;

        $product = $objectManager->create('Magento\Catalog\Model\Product')->load($productId);

        try {
            $product->setStoreId($store);
            $product->setStatus($status);
            $product->save();

        } catch (\Exception $e) {
            echo "Error Id : " . $productId;
        }
0

fast solution, check this link https://webkul.com/blog/how-to-check-if-use-default-value-checked-for-a-product-attribute-value-in-magento-2/

cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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