Pixel-Open / magento-product-main-category

The module adds a main category attribute to product.

Repository from Github https://github.comPixel-Open/magento-product-main-categoryRepository from Github https://github.comPixel-Open/magento-product-main-category

Magento Product Main Category

Minimum PHP Version Minimum Magento Version GitHub release

Presentation

The module adds a main category attribute to product.

Product Main Category

Requirements

  • Magento >= 2.4.4
  • PHP >= 8.0.0

Installation

composer require pixelopen/magento-product-main-category

Retrieve Product Main Category value

$mainCategory = $product->getMainCategory();

// OR

$mainCategory = $product->getData('main_category');

// OR

$mainCategory = $product->getCustomAttribute('main_category')?->getValue();

About

The module adds a main category attribute to product.

License:MIT License


Languages

Language:PHP 100.0%