-
Notifications
You must be signed in to change notification settings - Fork 218
Remove placeholder image rendering and delegate it to Core's get_image function #12098
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.61 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job :) Tested - this works correctly!
One minor consideration (not seeing it as a blocker).
It seems like there was a discussion and some intentionality behind setting alt
to ''
for the placeholder.
It seems that the core placeholder sets the alt
to the name of the Product
. It doesn't seem like a big deal to me, but perhaps it would make sense to create an Issue or a PR in Woo core to remove the alt
, if that's the preferred option.
@danieldudzic, thanks for taking care of that PR! 🙌 |
What
Remove the
wc_placeholder_img
invocation and keep theget_image
function call below.Fixes #12078
Why
wc_placeholder_img
was called inProductImage
block if there was no product image. But that breaks some extensibility aswoocommerce_product_get_image
hook is not fired. We can simply callget_image
which internally handles the logic if there's no image (here) and in addition apply the filters.Context:
if
is unnecessary and we can delegate that logic to Core's function$placeholder
istrue
by defaultTesting Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Case 1: Rendering images
Case 2: Applying filter
functions.php
Screenshots or screencast
woocommerce_product_get_image
hook|
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog