Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Add filter to thumbnail image#155

Closed
nickrouty wants to merge 1 commit into
kilbot:masterfrom
nickrouty:patch-1
Closed

Add filter to thumbnail image#155
nickrouty wants to merge 1 commit into
kilbot:masterfrom
nickrouty:patch-1

Conversation

@nickrouty

Copy link
Copy Markdown

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.

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.
@kilbot

kilbot commented Jan 30, 2017

Copy link
Copy Markdown
Owner

Hi. Thanks for the contribution. There is already a filter for this which is part of WooCommerce core. Please use the woocommerce_placeholder_img_src filter.

@kilbot kilbot closed this Jan 30, 2017
@kilbot

kilbot commented Jan 30, 2017

Copy link
Copy Markdown
Owner

Sorry, just re-read your requirement and see that you need a product_id ... this is probably available in the global $post object ... but having a pos filter would also make sense. Can you make the filter woocommerce_pos_product_thumbnail and move it to this line and then I will merge this pull request.

@kilbot kilbot reopened this Jan 30, 2017
@nickrouty

Copy link
Copy Markdown
Author

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.

@nickrouty nickrouty closed this Feb 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants