I need to remove the image title/name below from product view pages. Magento version 2.2.5. Anyone know how do this?
The expectation is without title/name :)
I need to remove the image title/name below from product view pages. Magento version 2.2.5. Anyone know how do this?
The expectation is without title/name :)
You need to override the fotoroma.js from location to your module:
lib/web/fotorama/fotorama.js
Then find showcaption and captions, then set those to false.
Now need to run static content deploy.
I have edited the
lib/web/fotoroma/fotoroma.js
directly This solved my problem.
Try this:
Create a custom module with below code.
app/code/Vendor/Module/etc/frontend/di.xml
With below code.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Block\Product\View\Gallery">
<plugin name="get_gallery_images_json_captions" type="Vendor\Module\Plugin\Gallery"/>
</type>
</config>
Now plugin file
app/code/Vendor/Module/Plugin/Gallery.php
With below code.
<?php
namespace Kunj\Gallery\Plugin;
class Gallery
{
public function afterGetGalleryImagesJson(
\Magento\Catalog\Block\Product\View\Gallery $subject,
$result
) {
$galleryOptions = json_decode($result,1);
foreach ($galleryOptions as $k => $options)
{
if(isset($galleryOptions[$k]) && isset($galleryOptions[$k]['caption']))
{
$galleryOptions[$k]['caption'] = "";
}
}
return json_encode($galleryOptions);
}
}
Now flush the cache and deploy static content.
I am also using magento 2 and Porto theme, for people who needs to do it via CSS can follow the following steps:
Add following css.
.fotorama__caption__wrap{
display:none !important;
}
After that clear the cache of magento and browser. The caption/label now must be hidden.