-
Notifications
You must be signed in to change notification settings - Fork 218
Fix: Password Protection not respected on single product template #10999
Fix: Password Protection not respected on single product template #10999
Conversation
c8844b8
to
25c5f23
Compare
…o 10939-password-protection-not-respected-on-single-product-template
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: +55 B (0%) Total Size: 1.38 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.
Really, really solid work on this @gigitux! Tough problem, but I believe you have solved it very gracefully.
I was able to replicate the original issue with trunk
and this PR indeed fixes it ✅
* @internal | ||
*/ | ||
class SingleProductTemplate { | ||
|
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.
Are two empty lines necessary?
$new_content = SingleProductTemplateCompatibility::add_compatibility_layer( $template->content ); | ||
$template->content = $new_content; |
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.
Could we not have just done:
$template->content = SingleProductTemplateCompatibility::add_compatibility_layer( $template->content );
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.
True! I didn't change that code, but I just moved! Should I create a follow-up PR?
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.
I don't think it's urgent. I think I'll create a follow up for it later and you can review if that works 😃
Appreciate the tests that have come with this also @gigitux. Thank you! |
What
Fixes #10939
Why
The function
add_password_form
adds the password form to the single product template when the first block that belongs to the single product block is founded. The rest of the blocks related to the Single Product template are removed.Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog