Customizing Product Model and Admin form



I’m trying to customize/extend the Product base model without success.

I’ve already done:

  • Extend model/entity and add “warehouse” field.
  • Update database schema (doctrine)
  • Extend ProductType Form from ProductBundle and added field

My problem is when I go to the admin -> Product -> Create. I cant see the new fields…
I saw somewhere in the docs that is needed to override the form templates but in the original Admin Product form templates there are a lot of menu/sections functions with the KnpBundle and I don’t want to re-build entirely the form view. So, It’s supossed if I add new fields to the form it should be directly rendered in the view.

Form Extension:

namespace App\Form\Extension;

Use Sylius\Bundle\ProductBundle\Form\Type\ProductType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

class ProductTypeExtension extends AbstractTypeExtension

     * {@inheritdoc}
    public function buildForm(FormBuilderInterface $builder, array $options): void
            ->add('warehouse', TextType::class, [
                'label' => 'app.form.product.warehouse',

     * {@inheritdoc}
    public function getExtendedType(): string
        return \Sylius\Bundle\CoreBundle\Form\Extension\ProductTypeExtension::class;


    class: App\Form\Extension\ProductTypeExtension
        - { name: form.type_extension, extended_type: Sylius\Bundle\ProductBundle\Form\Type\ProductType, priority: -5 }


    driver: doctrine/orm
                model: App\Entity\Product

What i’m doing wrong?

Thank you.


You have to add the field to the template(s).
Check SyliusAdminBundle/views/Product/Tab/_details.html.twig and SyliusAdminBundle/views/ProductVariant/Tab/_details.html.twig.


Thank you very much! this is what I was looking for.