Reading list Switch to dark mode

    How to add a new field in the product pricing tab for the new product page V2 in PrestaShop 8.1

    Updated 11 December 2023

    In this blog, we are going to learn how to add a new field in the product pricing tab for the product V2 page in PrestaShop.

    We will add a new field MSRP (tax inc.) as you can see in the below image.


    So let’s see together how to do that with PrestaShop.

    Sometimes, we need to add new fields in the pricing tab so the admin can enter and save the field data.

    We will get it only by changing in module main file.

    Searching for an experienced
    Prestashop Company ?
    Find out More

    Thanks to the available hooks, it’s super easy to add new fields in the form!

    We will register the ‘actionProductFormBuilderModifier‘ hook in our module using the below code.


    After registering, We will do the below code in our module main file.

    public function hookActionProductFormBuilderModifier(array $params)
            $msrp = 'your field value from DB';
            $form_builder_modifier = new FormBuilderModifier();
            $form_builder = $params['form_builder'];
            $pricingTabFormBuilder = $form_builder->get('pricing');
            $contextLocale = Tools::getContextLocale($this->context);
                $pricingTabFormBuilder, // the pricing tab
                'retail_price', // the input/form from which to insert after/before
                'msrp_price', // your field name
                MoneyType::class, // your field type
                    'required' => false,
                    'attr' => [
                        'placeholder' => 'MSRP (tax inc.)',
                        'data-display-price-precision' => CommonAbstractType::PRESTASHOP_DECIMALS,
                        'data-price-specification' => json_encode($contextLocale->getPriceSpecification($this->context->currency->iso_code)->toArray()),
                    'row_attr' => [
                        'class' => 'retail-price-tax-excluded',
                    'currency' => $this->context->currency->iso_code,
                    'constraints' => [
                        new NotBlank(),
                        new Type(['type' => 'float']),
                        new PositiveOrZero(),
                    'default_empty_data' => 0.0,
                    'modify_all_shops' => true,
                    'label' => 'MSRP (tax inc.)', // you can remove the label if you dont need it by passing 'label' => false
                    // 'label_attr' => [ // customize label with any HTML attribute
                    //     'title' => 'h2',
                    //     'class' => 'text-info',
                    // ],
                    // this is just an example, but in real case scenario, you could have some data provider class to handle more complex cases
                    'data' => $msrp,
                    'empty_data' => '',
                    'form_theme' => '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit_base.html.twig',

    In the above code, we have used the FormBuilderModifier class to add a new column in the pricing tab form builder.

    That’s all about this blog. Hope it will help you.

    If you are facing any issues or doubts in the above process, please feel free to contact us through the comment section.

    We would be happy to help.

    Also, you can explore our PrestaShop Development Services & a large range of quality PrestaShop Modules.

    For any doubt contact us at [email protected].

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home