0

I want to add a price attribute for my product.

So I can add this to my product as a decimal attribute but...I don't know how to give him the options in order that this attribute comes out with the same render as existing price in the product form. Tried to investigate the magento catalog and the magento wee tax but I didn't found anything very understandable.

I want to come out with that result: any idea ?

price

1 Answer 1

0
$eavSetup->addAttribute(
            Product::ENTITY,
            'price_kg',
            [
                'group' => 'General',
                'sort_order' => 30,
                'type' => 'decimal',
                'backend' => Price::class,
                'frontend' => '',
                'label' => 'Prix au Kg',
                'input' => 'price',
                'class' => '',
                'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
                'visible' => true,
                'required' => false,
                'user_defined' => false,
                'default' => '',
                'searchable' => true,
                'filterable' => false,
                'comparable' => true,
                'visible_on_front' => true,
                'used_in_product_listing' => true,
                'unique' => false,
                'apply_to' => ''
            ]
        );

Not exactly the same rendering though but it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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