How to create category attribute Programmatically in Magento 2?

We can create custom category attributes with text fields programmatically in Magento 2 using a simple module.

In our demo, we have created a simple text field attribute for a category to save the value and use it on the front end.

You can see a category attribute in the backend using Catalog -> Categories Page.

Click on Any category and you can see our custom attribute in General Section after the category name.

If you are interested to create a drop-down select category attribute, Learn More Continue reading “How to create category attribute Programmatically in Magento 2?”

How to upload Placeholder images in Magento 2?

A placeholder image is a default image for a store to draw attention to the need for an actual image. Its temporary image for an actual image.

Sometimes product actual images are not available at that time placeholder images to represent the product in a site for each place like catalog product page, listing page, mini cart and cart page.

Continue reading “How to upload Placeholder images in Magento 2?”

Get Placeholder image url in Magento 2.

Native Magento 2 has four types of placeholder images called, small_image, image, thumbnail, and swatch_image.

Placeholder image URL is used when you want to display default images for a site.
Magento 2 gets a placeholder image URL using below simple code snippet. Continue reading “Get Placeholder image url in Magento 2.”