New answers tagged

0 votes

How to get the product type?

For ordered product list, from order collection we can use $item->getProductType() to get the Product type. Sample code set <?php ...... foreach ($orders->getAllItems() as $item) { echo $...
  • 2,651
1 vote
Accepted

How to Create Bulk Product Attributes in magento 2?

Can you try using below script and create bulk product attributes:- <?php use Magento\Framework\App\Bootstrap; require __DIR__ . '/../app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $...
  • 3,550
0 votes

Add Wysiwyg attribute to Product in Magento 2

The answer shared by Msquare is indeed correct but there are some small issues. First in the InstallData.php file which creates the attribute is_wysiwyg_enabled => true, should be changed to ...
0 votes

magento 2.4 product collection filter by custom attribute value instead of id

Get Option id from $product Object $attr = $product->getResource()->getAttribute('color'); if ($attr->usesSource()) { $optionId = $attr->getSource()->getOptionId("Red");...
  • 5,961
0 votes

magento 2.4 product collection filter by custom attribute value instead of id

Yes, you can filter the product collection using the option value instead of the option id in Magento 2.4. To achieve this, you need to use the addAttributeToFilter method with an array as the value ...
2 votes
Accepted

How to delete empty attribute values in Magento 2

Okay, I figured it out. I couldn't find a single SQL command to do everything but this is the process I used to fix this. go to the eav_attribute table of your database and find the attribute_id of ...
  • 33

Top 50 recent answers are included