Magento 2.2.2, when an item is added to the cart, any customizable options selected when adding a product to the cart are not displayed in the cart or order.
In testing, I have found that the Sku that is passed to CheckoutCartProdtuctAdd does not contain the part of the SKU specified in the customizable option.
I have a backup from a month ago that does pass the Sku correctly, I have compared files and tested and found that the problem is caused by an entry in the database i.e. if I get the working backup and run it up with its database it works, but if I run it with a copy of the database from the current non-working site the problem is there.
I am sorry I cannot give steps to recreate as I don't know when this happened or what caused it.
Any help deeply appreciated as I am tearing my hair out!
Many thanks
John
Best Answer
The problem was: I had overwritten
Magento_Catalog\templates\product\view\details.phtml
, in the file, I had some temporary code that was making some attribute value changes to the configurable and it's children and saving them both.Calling
$product->save()
on the configurable product, in this case, causedhas_options
andrequired_options
in the database tablecatalog_product_entity
to be set to 0 regardless of whether the product has options or not.I removed the line that saved the configurable product, then reset
has_options
andrequired_options
to 1 for all configurable products that had options to stop the problem recurring.