0

Im using Magento2 v2.3.3 Open source.

My store consist of around 76000 products and some of them are missing product images. Is it possible without much coding to hide products on the frontend that doesn't have product images?

I have already looked at these but It didn't do much for me:

1 Answer 1

0

The simplest way and cheapest (in number code lines) is to create a custom cronjob that verifies whether products have images and if not, it disables them.

This will cause exclusion from the sitemap.xml, 404 on PDP access and exclusion from any category listing or search results (as the product's associated document(s) in Elasticsearch will be removed).

4
  • May I ask why using cronjob? I mean this is not a schedule task. Could we just write a script to check and set product visibility from the script itself?
    – Jimmy
    Commented Mar 30, 2021 at 2:17
  • yes, of course you can write a script to check and set the proper visibility, but i am thinking more of a long term solution. if you have, for example, product imports from a 3rd party entity (erp, pim, etc), then the problem will reoccur, so i was thinking of a cronjob that can be scheduled after such an import and deal with the problem :)
    – Diana
    Commented Mar 30, 2021 at 5:52
  • How would I set up a cronjob like this? :) Commented Mar 30, 2021 at 12:31
  • Check this article devdocs.magento.com/guides/v2.2/config-guide/cron/… you will have to create a custom cron in Magento and in its execute() method call another model that collects the list of products which have no images and disables them.
    – Diana
    Commented Mar 30, 2021 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.