Add Custom Option in Product Programmatically in Magento 2.

Magento 2, Product with custom option used to allow customers to customize the product as per the need from a set of different Custom options.

The custom option is a native feature of Magento and you can add the Custom option by Admin side in product Section.

You can add multiple types of custom option like Text field, Text area, Dropdown, Checkbox, Radio button, File(Image), Multiple Select, Date, Date & Time, Time. Continue reading “Add Custom Option in Product Programmatically in Magento 2.”

Magento 2 Get layered navigation filterable attributes list.

Magento 2 Get all the attribute list which are used in Layered Navigation in category page and search page.

You can get all the filterable attribute list by Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory class.

The result will be all those attributes that have,

  1. Use in Layered Navigation status are Filterable (with results)
  2. Filterable (no results)

Continue reading “Magento 2 Get layered navigation filterable attributes list.”

How to Get Last Order id in Magento 2?

Magento 2 Get Last order in any page using Checkout Session. You can fetch Last order id of order by Magento\Checkout\Model\Session Object.

You need to create __construct( ) function for define dependency of Session Class Continue reading “How to Get Last Order id in Magento 2?”