bk_developer Posted June 2, 2022 Share Posted June 2, 2022 (edited) Hi I am trying to add a custom field by the name "minimumprice" in product form right after the wholesale_price. I have used the following code to achieve it. But it is not working. Custom field is not displayed in the product form. public function hookActionProductFormBuilderModifier(array $params) { /** @var $formBuilder \Symfony\Component\Form */ $formBuilder = $params['form_builder']; $allFields = $formBuilder->all(); foreach ($allFields as $inputField => $input) { $formBuilder->remove($inputField); } foreach ($allFields as $inputField => $input) { $formBuilder->add($input); if ($inputField == 'wholesale_price') { /** @var MoneyType::class \Symfony\Component\Form\Extension\Core\Type\MoneyType */ $formBuilder->add( 'minimumprice', MoneyType::class, ['label' => 'Minimum Price'] ); } } } Edited June 2, 2022 by bk_developer (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now