-
Notifications
You must be signed in to change notification settings - Fork 219
Pattern: fetch product id on the JS side #11138
Pattern: fetch product id on the JS side #11138
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
node_modules/@woocommerce/data/build-types/countries/index.d.ts
node_modules/@woocommerce/data/build-types/export/index.d.ts node_modules/@woocommerce/data/build-types/import/index.d.ts node_modules/@woocommerce/data/build-types/items/index.d.ts node_modules/@woocommerce/data/build-types/onboarding/index.d.ts node_modules/@woocommerce/data/build-types/options/index.d.ts node_modules/@woocommerce/data/build-types/orders/types.d.ts node_modules/@woocommerce/data/build-types/payment-gateways/index.d.ts node_modules/@woocommerce/data/build-types/plugins/actions.d.ts node_modules/@woocommerce/data/build-types/plugins/index.d.ts node_modules/@woocommerce/data/build-types/product-attributes/types.d.ts node_modules/@woocommerce/data/build-types/product-shipping-classes/types.d.ts node_modules/@woocommerce/data/build-types/products/actions.d.ts node_modules/@woocommerce/data/build-types/products/types.d.ts node_modules/@woocommerce/data/build-types/user/types.d.ts node_modules/@woocommerce/data/typings/index.d.ts |
Size Change: -69 B (0%) Total Size: 1.47 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.
LGTM! Tested well. Thanks for handling this so quickly!
What
Fixes #11103. Fix unnecessary queries on the front end side.
Why
The patterns are currently registered during the init action, which implies that these patterns are registered on the frontend. However, there is a problem with the current setup: two patterns perform a custom query each time a page is rendered on the frontend.
This pull request addresses this issue by transferring the logic responsible for fetching the product ID from PHP to JavaScript.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Product hero
andProduct details listing
patterns.Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog