I had an issue when we add a product attribute as a Media Image type. I created the attribute successfully through the backend.
But it is not displaying in the Add Product page in the back end. I selected the corresponding attribute in Add Attribute area also.
Finally, I got the proper way to solve this problem. We can add media images through the section "Images and Videos". After uploading the image, just click on that image and specify it as an attribute image.
Currently there is a bug with custom Media Attributes. You can read about this on forum. I resolve this by entering Browser Inspector and display proper tab (Storefront Properties) in Magento 2 Admin Panel (just remove display:none style), to set "Used in Product Listing" to Yes. Then you can use this in .phtml file by code:
$product->getCustomAttribute( 'attribute_code' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With