cancel
Showing results for 
Search instead for 
Did you mean: 

Error "Option values are not specified" in create configurable product

Error "Option values are not specified" in create configurable product

I have an error that occurs randomly when I go to create a configurable product. The process is as follows: First I create all the simple products and in an array, I store all the ids of the simple products. Then through the following code, I go to create the configurable product.

 

$this->_product->save(); //$this->_product Corresponds to the configurable product with the weight, sku set

$this->_productIdCreated = $this->_product->getId();

$configurableproduct_load = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($this->_productIdCreated);

$configurableproduct_load->setAssociatedProductIds($listSku);

$configurableproduct_load->setCanSaveConfigurableAttributes(true);

$configurableproduct_load->save(); //The error is generated at this point

If I start the script for creating products via php script, the configurable product is not always created giving the following error: "ERROR: "Option values are not specified".

The error doesn't show up every time, but a few times. When the error is generated, all the simple products to the associated custom product exist with their attributes set. The custom product is not created. What can I do? Using magento 2.4.1.

Thank you all

3 REPLIES 3

Re: Error "Option values are not specified" in create configurable product

Hi @gbgssoftwad791 ,

 

You need to do reindex programatically after creating associate products which have weight and sku.

 

After programmatically reindex, you need to create configurable product.

 

Problem Solved? Accept as Solution!

 

Hope it helps!

Thanks

Ankit Jasani

Re: Error "Option values are not specified" in create configurable product

Hi @Ankit Jasani ,
thanks for the solution.
I start implementing the function.
I have a question, would it be possible to reindex only some simple products via the sku?
Thank you

Re: Error "Option values are not specified" in create configurable product


@Ankit Jasani wrote:

Hi @Fragomen Connect Login

 

You need to do reindex programatically after creating associate products which have weight and sku.

 

After programmatically reindex, you need to create configurable product.

 

Problem Solved? Accept as Solution!

 

Hope it helps!

Thanks


Did you have a fix on this issue?