forked from woocommerce/woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Determine _product_template_id from WP filter (woocommerce#47762)
* Remove template matching from front-end * Create 'woocommerce_rest_get_product' filter to allow extensions to change the product when it's fetched through the REST API * Stop defaulting to 'standard-product-template' product template and handle defaults only in getLayoutTemplateId function * Use created hook to determine and persist the product template ID when it's not defined. Also introduce 'match_fn' in ProductTemplate to allow extensions to provide robust ways of matching the template * Add changelog * Fix tests * Remove outdated tests * Fix issue in filter because $product can be false and move API change to v3 * Add comments to continue statements * Small refactor * Only send layout template id to useLayoutTemplate after product is loaded * Revert front-end changes * Remove match_fn and create filter to allow extensions to determine the product template id * Avoid loading layout template before product is loaded * Create woocommerce_product_editor_determine_product_template filter and use it * Update changelogs and remove unused code * Remove _product_template_id for products that were created with the new product editor. * Use only id to find productTemplate * Turn hook into experimental * Remove deprecated tests * Rename filter * Add more typings to useEntityRecord * Use hasResolved boolean to check whether product has been resolved * Add changelog * Add 'variation' to ProductType * Don't default to the standard-product-template for variations * Update changelog * Accept null in getLayoutTemplateId * Fix edit variable product test * Rename hook * Revert changed logic to avoid regressions * Increment useProductTemplate logic * Default to standard-product-template instead of undefined when no matches * Re-import Features class --------- Co-authored-by: Jon Lane <jon.lane@automattic.com>
- Loading branch information
Showing
13 changed files
with
90 additions
and
30 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/js/block-templates/changelog/add-backend-template-match
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: tweak | ||
|
||
Change useLayoutTemplate signature from 'undefined' to 'null' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: add | ||
|
||
Add 'variation' to ProductType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/js/product-editor/changelog/fix-loading-layout-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fix | ||
|
||
Tweak useProductTemplate logic and avoid loading layout template before product is loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Determine _product_template_id from 'woocommerce_product_editor_determine_product_template' filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters