-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweak useProductTemplate's logic and add new filter to allow changing the product template #47559
Conversation
…ple product types for a single template
… the product tempalte
@@ -63,29 +63,25 @@ protected function is_product_supported( $product_id ): bool { | |||
return false; | |||
} | |||
|
|||
$digital_product = $product->is_downloadable() || $product->is_virtual(); |
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.
Removed this since it was unused
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
Submission Review Guidelines:
Changes proposed in this Pull Request:
Tweak useProductTemplate's logic and add a new filter to allow changing the product template.
This demand came while migrating an extension where I needed to control the product template loaded depending on the parent's data to ensure backward compatibility with products created in the legacy editor (since new ones have the product template ID persisted to them).
I've also added a variable product template, which doesn't show in the list. I found that it simplifies the logic and makes it more robust since the special handling starts to get tough when adding new templates supporting variable products.
Please let me know if any issues with this idea.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
test-change-template.zip
Changelog entry
Significance
Type
Message
Comment