-
Notifications
You must be signed in to change notification settings - Fork 2
Product Attributes
Code Slicer edited this page Sep 12, 2022
·
13 revisions
Allows managing the eav attributes related to products. Import it as follows:
private Migration\Facade\ProductAttribute $productAttribute;
public function __construct(
Migration\Context $context,
Migration\Facade\ProductAttribute $productAttribute
) {
parent::__construct($context);
$this->productAttribute = $productAttribute;
}
💡 Tip: The same as Category Attributes applies here, alongside the product exclusive ones listed below.
Create a new dropdown attribute. Eg.:
$this->productAttribute->createDropdown('sizes', "Clothes Size", ['P', 'M', 'G']);
Well, it's pretty much what the name implies. Assign to default if no option is supplied. Eg.:
$this->productAttribute->assignToAttributeSet('my_new_attribute', [
'attribute_set_id' => 1,
'group_id' => 'General',
'sort_order' => 30,
]);
We want YOU for our community 🫵