-
Notifications
You must be signed in to change notification settings - Fork 219
Enable Product Collection as a core feature #10524
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: -487 B (0%) Total Size: 1.43 MB
ℹ️ View Unchanged
|
… in favour of Product Collection ones (#10548) * Limit the scope of Product Query's Product Title and Product Summary * Add missing piece after refactoring
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.
Excellent work here @kmanijak and @imanish003 🎉 !
I've flagged one problem and left a few questions/suggestions.
Test Results
1. Inserting ( ✅ All tests pass - 1 question)
Type "Product Collection" and "Products (Beta)"
In both cases Product Collection (Beta) should appear in the inserter
❓ Question: When typing "Products (Beta)", both the Products (Beta) and the Product Collection (Beta) blocks are displayed: is that expected?
Try to insert it
It should appear correctly in the Editor
Save and make sure it displays correctly in the Frontend
✅ Confirmed the Product Collection (Beta) block can be inserted in the editor.
✅ Confirmed the Product Collection (Beta) block is correctly displayed on the front end.
2. Inherit from query template (✅ 3 success, ❌ 1 failure, 1 Suggestion)
- Product Collection - Editor settings: Inherit query from template #9358
(instructions copied from9358
)
I would recommend porting over the instructions from 9358
to this issue to facilitate/expedite the work for reviewers.
Testing with Product Archive templates
Open the Editor and navigate to the "Product Search Results"
Replace the existing 'Classic Template' block with the 'Product Collection' block.
After the 'Product Collection' block is successfully inserted, ensure that the 'Inherit query from template' option is enabled by default.
✅ Confirmed the 'Inherit query from template' option is enabled by default:
Save the changes.
Navigate to the frontend of your website. You can emulate a search for "shirt" by visiting the URL "/shop?s=shirt". Confirm that the search query shirt effectively displays related products.
✅ Confirmed the search results are returned correctly:
Head back to the Editor.
In the 'Product Collection' block, deactivate the 'Inherit query from template' option.
Subsequently, you should observe various settings and filters available in the inspector controls. Modify these filters and settings as required and validate immediately that the changes are visible within the Editor.
✅ Confirmed the settings are working as expected, and changes are visible in the editor.
Screen.Recording.2023-08-17.at.20.56.40.mov
Save your modifications and return to the frontend of your website.
Ensure that the adjustments made to the 'Product Collection' block within the Editor are accurately displayed on the frontend of your website.
❌ When Inherit query from template is disabled in the editor, the search for products doesn't work anymore:
Screen.Recording.2023-08-17.at.21.04.43.mov
Testing in Post
Create a new post
Add Product Collection block to the post
With the 'Product Collection' block selected, open the Inspector Controls (located in the right sidebar). Confirm that the option inherit query from template does not appear in the list of options. This is because it's relevant only for Product Archive pages and should not be visible in this context.
✅ Confirmed the inherit query from template option is not displayed when inserting the block in the post editor:
3. Filters ( ✅ Pass )
- Add Product Collection and Products (Beta) block side by side
- Disable "Inherit query from template" in both
- Set of filters should appear in the Inspector Controls
- Play around with the filters setting up the same conditions in both cases (be aware Product Collection offers more filters than Products (Beta), so you may not be able to recreate all of the scenarios in Products (Beta) block)
- Treat Products (Beta) block as a reference - the results in product grid should be the same in both cases.
✅ Confirmed filters are working as expected.
4. Global Styles ( ✅ Pass, 1 Suggestion )
- Add Product Collection and Products (Beta) block side by side
- Play around with the Global Styles of Product Collection/Products, Product Template and particular Product Elements.
- As in case of Filters we look for discrepancies between blocks. If there's bug that occur in both blocks, feel free to report it but it's not a blocker to release Product Collection.
✅ Confirmed styles are correctly applied. Tested with different global style variations and block level changes to color and typography.
Suggestion: can we add a few more details to the testing instructions for other folks going through this test step? While for us as a team, "Play around with the Global Styles" is very intuitive, I'm not sure if all folks on Global Step or anyone else testing have the same level of understanding.
5. Product Elements ( ✅ Pass, 1 Question )
- Make sure you're able to add all of the following blocks in Product Template of Products Collection
- Product Image
- Product Title
- Product Price
- Product SKU
- Product Summary
- Product Rating
- Product Stock Indicator
- On sale badge
- Add to Cart Button
❓ Question: The "Product Summary" block is not available anywhere: did we intentionally remove this block, or is this a regression?
6. Others - play with it ✅
- Play with Product Collection as you would as a merchant. Test it, try to break it. Think of stuff we didn't think of and try it out!
✅ I did a few extra tests, such as checking mobile view and rearranging blocks within the Product Collection block and confirmed things are working as expected.
@nefeline thanks for a great review! 1. Inserting
Yes, it was added in: #10112 considering that eventually Products (Beta) block will be hidden from the inserter, hence I think it makes sense to display Product Collection (Beta) as an alternative already. But if you think it's confusing we can revert that change and add it only when hiding Products (Beta) from inserter. What's your opinion on that? 2. Inherit from query template
Yeah, good suggestion, will do!
I think that's expected. When you disable the "Inherit query from template" Product Collection becomes a static product grid fully controlled by the merchant. It displays whatever you configure in Editor and only if the "Inherit query from template" option is enabled Product Collection will adapt to the context, in this case displaying search results. The same behavior can be reproduced with Products (Beta) or Query Loop (from which the behavior was adapted) blocks. Please let me know if that makes sense. Also, I glanced through the testing instructions checking if there was some misleading point but didn't find it. Do you recall if there's a point that made the impression it should work as you described? 🙏 5. Product Elements
That's unexpected. The worst part being I cannot reproduce it:
Are there any specific conditions under which you faced that issue? Was it a post or template editor? 🤔 |
If hiding the Products (Beta) block from the inserter is something that we are planning to do sooner than later, then I think it's ok to keep it as is 👍 . In the long term, it can be confusing having the user look at two different options to insert products in their posts/templates, with the first one on the list being the one we are planning to retire Products (Beta) instead of the new one introduced here Product Collection (Beta).
🙌
IMO basically all arguments we used for making the filters contextual (which is now being addressed by @roykho and @dinhtungdu as part of woocommerce/woocommerce#42255 ) are also applicable here. If the store owner decided to display only products in stock in their store, users on their site should still be able to search for these products. At a minimum, in this first moment, I'd recommend not allowing disabling the "Inherit query from template" option when the Product Collection (Beta) block is inserted within the Product Search Results template, otherwise, this is the experience users will have: Screen.Recording.2023-08-18.at.14.39.51.mov
I can't reproduce what you are seeing 🤔 . As another example, here's a direct comparison between the Single Product block and the Product Collection (Beta) block when attempting to insert the Product Summary to them: Screen.Recording.2023-08-18.at.13.51.28.movI also tried the same approach as you did, add a paragraph and insert the summary in it, also doesn't work:
Not really, the product summary is simply unavailable across the board (both in the post and template editors). I'm glad to jump on a call & help narrow down the cause if that helps! |
I've started investigating, and I'm encountering a slightly different issue. In template editing:
However, when it comes to posts, I'm noticing the presence of two Summary blocks within the Single Product as you can see in demo below: Screen.Recording.2023-08-23.at.11.16.07.AM.mov@kmanijak It seems that we'll need to find an alternative solution to address our challenge of duplicate Title and Summary blocks. The approach we implemented in #10548 doesn't appear to be achieving the desired outcome. Can you reproduce this issue as well? |
This commit refactors the product-collection block's variation registration. Changes: - The `product-summary` and `product-title` variations have been encapsulated within their own respective functions: `registerProductSummaryVariation` and `registerProductTitleVariation`. - Imported and invoked these new functions in the main `index.tsx` of the product-collection block, ensuring the variations are registered.
Hi @nefeline 👋🏻
As we discussed during our call, it would be beneficial to create a separate discussion for this matter. Additionally, as agreed upon in the call, we concluded that this issue doesn't act as a roadblock for the release of the Product Collection block because:
I've successfully replicated the issue you raised concerning the unavailability of the I am extremely grateful for your comprehensive review of this pull request. Your efforts are highly appreciated! 🙌🏻 |
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.
Hi @imanish003,
Thanks for addressing all the feedback!
Regarding:
as agreed upon in the call, we concluded that this issue doesn't act as a roadblock for the release of the Product Collection block because:
It mirrors the behavior of Query Loop and Products beta block.
The scope of this also includes Products by category, tag, etc., Based on the decision, we will need to make the same change for these templates too.
Adding here that per @shaunandrews feedback, we will be removing this toggle, in favor of having "Collections" — one of which will be the default query. ref. p1692873557131709-slack-C02FL3X7KR6
I am extremely grateful for your comprehensive review of this pull request. Your efforts are highly appreciated! 🙌🏻
Likewise! Thanks for your promptness in addressing the problems flagged here during the code review and your efforts in developing this block 🥇
Fixes #10430
Testing
Automated Tests
Product Collection has E2E and PHP Unit Tests covering some parts of the functionalities.
User Facing Testing
This PR enables a block that's been developed for a couple of months. Product Collection includes many functionalities and each of the changes at the moment of merging the particular functionalities. I don't think we should test ALL of them again, especially since the testing steps would be unreadable. However, I believe the major paths should be re-tested.
In some cases, I linked PRs. In that case, please refer to the testing scenarios from respective PR:
Major scenarios
Inserting
npm run build:deploy
if you test locally. Ignore this step when testing plugin as a whole.Inherit from query template
Filters
Here is the list of filters for reference if you prefer to follow some specific scenarios:
Global Styles
Product Elements
Others - play with it
WooCommerce Visibility
Changelog