-
Notifications
You must be signed in to change notification settings - Fork 2
Eav Attributes
Code Slicer edited this page May 18, 2023
·
2 revisions
There are dedicated facades for each type of entity as can be seen here, and all of them share these common methods described below.
Create a new attribute with given data, just as you would do in the native $this->eavSetup->addAttribute() method:
// we suggest checking the available fields here: https://mage2gen.com/?main_version=4
$this->categoryAttribute->create('bottom_description', [
'type' => 'text',
'label' => 'Description (Bottom)',
'input' => 'textarea',
'sort_order' => 50,
'source' => '',
'global' => 0,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => null,
'group' => 'General Information',
'backend' => ''
]);
Updates an existent eav attribute of the entity:
$this->productAttribute->create('origin_postcode', [
'required' => true,
]);
Check if an attribute with given code already exists for the entity:
$this->customerAttribute->exists('is_vip');
We want YOU for our community 🫵