cancel
Showing results for 
Search instead for 
Did you mean: 

Customizable Options bulk update

Customizable Options bulk update

Hello everyone,

 

In my store, customers can add extra stuff in the "Customizable Options" section and these settings are the same for all product. Is there any way to change it globally instead of going through 1 by 1?. Thank you.

 

Cheers.

2 REPLIES 2

Advance product option extension can solve your problem.

Please look this extension can be solve your issue. 
https://www.mageworx.com/advanced-product-options-magento-extension.html

Re: Customizable Options bulk update

I think you should have to go for add custom option programmatically way.

 

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); //instance of Object manager
        $productId = 50;
        $product = $objectManager->create('\Magento\Catalog\Model\Product')->load($productId);
        $values = [
            [
                'record_id'=>0,                                        
                'title'=>'Red',
                'price'=>10,
                'price_type'=>"fixed",
                'sort_order'=>1,
                'is_delete'=>0
            ],
            [
                'record_id'=>1,                    
                'title'=>'White',
                'price'=>10,
                'price_type'=>"fixed",
                'sort_order'=>1,
                'is_delete'=>0
            ],
            [
                'record_id'=>2,                    
                'title'=>'Black',
                'price'=>10,
                'price_type'=>"fixed",
                'sort_order'=>1,
                'is_delete'=>0
            ]
        ];
         
        $options = [
            [
                "sort_order"    => 1,
                "title"         => "Field Option",
                "price_type"    => "fixed",
                "price"         => "",
                "type"          => "field",
                "is_require"    => 0
            ],[
                "sort_order"    => 2,
                "title"         => "Color",
                "price_type"    => "fixed",
                "price"         => "",
                "type"          => "drop_down",
                "is_require"    => 0,
                "values"        => $values
            ],[
                "sort_order"    => 3,
                "title"         => "Multiple Option",
                "price_type"    => "fixed",
                "price"         => "",
                "type"          => "multiple",
                "values"        => $values,
                "is_require"    => 0
            ]
        ];
         
        $product->setHasOptions(1);
        $product->setCanSaveCustomOptions(true);
        foreach ($options as $arrayOption) {
            $option = $objectManager->create('\Magento\Catalog\Model\Product\Option')
                    ->setProductId($productId)
                    ->setStoreId($product->getStoreId())
                    ->addData($arrayOption);
            $option->save();
            $product->addOption($option);
        }

In case you want to save the same custom option for all products then you should go for programmatically way.

 

I have to write code for a single product you have to do it for multiple products.

If Issue Solved, Click Kudos/Accept As solutions.