Customization value lost after combination change, leading to customization mess
Prerequisites
- [X] I understand and accept the project's code of conduct
- [X] I have already searched in existing issues and found no previous report of this bug.
Describe the bug and add screenshots
If our store has a product with customization and combination options and a customer, in the product page, first adds a customization and then changes the combination, the ID of the combination changes to "0" ("product_customization_id" input) and some weird stuff can be done, like having in the cart a product that has a mandatory combination without it, or having a product with two customizations. In the steps to reproduce, I show some examples of this behavior and if you read that section you will understand the problem.
Expected behavior
When we add the same product twice but with two different customizations, two products should appear in the cart with one customization each, and when we delete one product, only one should remain with it's customization.
Steps to reproduce
Create a customizable product and add some combinations (we used sample "Customizable mug" product, and added some size combinations). Product should look like this:
First, add a product customization (write some text and click "save customization") and then change the combination (order is the key).

If you inspect the input id="product_customization_id" you will see that value after the combination change has changed to "0", but customization is still shown to the user in the form above. If you refresh the page, product_customization_id value will be back to normal. But it is not only that, we can manage to do some weird stuff:
Let's start again: Access the product page, add some customization, change the combination and add the product to cart. Everything should look fine. Then repeat the process again. Add to the cart the same product with other customization and size (remember, first we have to select the customization and then change the combination).
Now the cart looks weird. We have two mugs but with two customizations each:

If we try to delete one mug from the cart, we see that customizations dissapear, or even we can't remove one mug (at least in the interface, if we refresh the page, the cart is empty). This way we can manage to buy a customizable mug that has a mandatory customization without it.

Probably, more weird things can be done this way.
PrestaShop version(s) where the bug happened
1.7.8.7 and 8.0.0
PHP version(s) where the bug happened
7.4.29 and 8.1.7
If your bug is related to a module, specify its name and its version
No response
Hello @obelisk-services,
I reproduce the issue with PrestaShop with develop branch. No error on 8.0.x branch

On 1.7.7.8 and 1.7.8.7 there is no error:
- 1.7.7.8


- 1.7.8.7


It's a regression.
Please be aware that some issues might take a very long time to be resolved. If this one is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider contacting a professional to help you.
Well done and thank you for the PR 🚀
Thank you
Hi,
I have tried on a fresh Prestashop installation (1.7.8.7) on a new docker container and I was able to reproduce de issue. Even more, the line that causes the issue is in the version code (https://github.com/PrestaShop/PrestaShop/blob/1.7.8.7/themes/_core/js/product.js#L231). Maybe you miss one step? Can you please try again?

PR https://github.com/PrestaShop/PrestaShop/pull/29635 on 1.7.8.x
In order to fix this issue, we need to merge 1.7.8.x into 8.0.x
Merge PR is here https://github.com/PrestaShop/PrestaShop/pull/29682
Closed as it has been fixed with this PR #29635
This issue initially targeted the 8.0 so we should check this issue on 8.0.x branch after https://github.com/PrestaShop/PrestaShop/pull/29682 has been merged
Delivered in 8.0.x