Theme-centric way to replace WooCommerce placeholder image

November 3, 2020 9:37 pm Published by Leave your thoughts

WooCommerce Theme developers have seen this image before.

And since WooCommerce 3.5, this default image can be set at WooCommerce > Settings > Products.

This is great!! Except what if you are a theme developer?

How can the placeholder image be replaced programmatically?

The snippet from the WooCommerce team doesn’t help.

As you can see, the image being replaced still resides in wp-content/uploads folder. And this version. wow. Really? haha

I guess hard-coded in url is simple and easy way to solve this problem except if you are crating a theme, you can’t use that method either.

Almost all premium WooCommerce themes provide their own default placeholder images but for my taste, their methods all seemed very convoluted for my taste.

So not having found any theme-centric method after googling, I’ve wrote my own simple method.

Tags: , , , , ,

Categorized in:

This post was written by hackya

Leave a Reply

Your email address will not be published. Required fields are marked *