Add filter to thumbnail image#155
Conversation
We store an external image in post meta for our products. We weren't able to hook into the prior calls to perform what we were needing to accomplish due to the post ID / product ID not being available globally. Due to this, the easiest thing would be to be able to view what was about to be returned via the get_thumbnail function, along with the product ID. We then take the ID, check if a product image exists in our post meta, and if so, update the return value.
|
Hi. Thanks for the contribution. There is already a filter for this which is part of WooCommerce core. Please use the |
|
Sorry, just re-read your requirement and see that you need a product_id ... this is probably available in the global |
|
I've created a new request, I'm not the greatest at github, sorry if I was able to simply modify this one. #156 I wasn't able to access the value via the global $post, I had initially tried to accomplish the task by utilizing existing filters without success. Not sure if the post wasn't being set in the loop for wc-pos or what was going on. |
We store an external image in post meta for our products. We weren't able to hook into the prior calls to perform what we were needing to accomplish due to the post ID / product ID not being available globally. Due to this, the easiest thing would be to be able to view what was about to be returned via the get_thumbnail function, along with the product ID. We then take the ID, check if a product image exists in our post meta, and if so, update the return value.