1

I want to hide some fields of product reference on node edit. My purpose is to unset or set access to false for colors or price field of line item included in node as inline entity from in a content type. I am using hook as

$form_state){
dsm($entity_form);
unset($entity_form['field_product_colors']); // remove "colors" field from inline entity form
 }

but hook is not called at this screen when user edit a product on node edit i have shared a node edit screen where product is edited by click on edit link and then update some thing but dont want colors and price to be shown thereenter image description here

0

Actually documentation of module in readme file the hook was written and i was using that hook but only problem was the custom module name. if your custom module name is two parts like custom_websitename then this hook did not work in my case, so after one day i changed module name to single word and hook worked.. I am sharing code incase someone need to update lineitemform in node edit for drupal commerce.

function customruba_inline_entity_form_entity_form_alter(&$entity_form,   $form_state){
$entity_form['commerce_price']['#access']=false;
$entity_form['field_commerce_saleprice_on_sale']['#access']=false;
$entity_form['field_commerce_saleprice']['#access']=false;
$entity_form['status']['#access']=false;
}

this worked for me to hide some information on inline entity form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.