How to get the product id on hook form alter I am currently working on drupal 8 commerce. I need to form alter some of the expose fields but need to get the product id first so I can get my condition on the product fields. I used this kint($form_state) on my form alter to show the attached image. But when I try use this $form['storage'] im having wsod. Thanks
If You alter 'Add to card form', try this code

$form_state-&gt;getFormObject()-&gt;getEntity()-&gt;getPurchasedEntity()-&gt;product_id-&gt;getString();