How to Get all products assigned to category by category id Magento 2.

You can retrieve all the products assigned to a specific category by category id in Magento 2.

Used interface:
Magento\Catalog\Api\CategoryLinkManagementInterface

Get Method from the interface to fetch a list of all the products, public function getAssignedProducts($categoryId); Continue reading “How to Get all products assigned to category by category id Magento 2.”

How to Get Category Attribute details by attribute code Magento 2?

Retrieve the category attribute details information by code in Magento 2, data will be attribute code, title, id, backend_type, source_model and many more.

You can Retrieve specific attribute details by the interface class, Magento\Catalog\Api\CategoryAttributeRepositoryInterface.

Use public function get($attributeCode) method to retrieve the information with below simple code of snippets, Continue reading “How to Get Category Attribute details by attribute code Magento 2?”

Retrieve list of attribute options by category attribute code Magento 2.

You can get list of all attribute options value by Category attribute code in Magento 2. You can fetch all the list of available options for the dropdown, multi select, checkbox type.

Let’s take an Example, We can get all the CMS Static Block assigned to specific attribute called, Add CMS Block(landing_page) is the drop down type category attribute.

You can get all the options label, value pair for the attribute from the interface class, Magento\Catalog\Api\CategoryAttributeOptionManagementInterface. Continue reading “Retrieve list of attribute options by category attribute code Magento 2.”