Skip to content
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

[Product Block Editor]: implement Choose products for me button #43520

Merged

Conversation

retrofox
Copy link
Contributor

@retrofox retrofox commented Jan 11, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR implements the Choose products for me button for the Upsells and Cross-sells sections of the Linked Product tab.

Part of #42922
Closes # .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Ensure your testing site has a few products to test
  2. Enable the Linked Product flag
  • Enable the WCA plugin
  • Click on Tools -> WCA Test Helper
  • Click on Features tab
  • Toggle on the product-linked feature
Screenshot 2023-12-26 at 11 36 05
  1. Edit/create a product by using the new Product Editor app
  2. Confirm you see the Choose products for me button in the Linked product sections
Screenshot 2024-01-11 at 13 41 45
  1. Confirm when the user clicks Choose products for me, we add five products
  2. Confimr If a store has less than 5 other products that are publicly published and in-stock, then we choose the maximum number of products they have.
  3. Confirm If there are products already selected under Upsell / Cross-sell (regardless whether they are user-selected ones or auto-generated ones), they all get replaced with the new recommended suggestions.
Screen.Recording.2024-01-11.at.13.44.16.mov

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@retrofox retrofox added focus: new product ux revamped product management experience team: Mothra WC Merchants activation and store management labels Jan 11, 2024
@retrofox retrofox requested a review from a team January 11, 2024 16:39
@retrofox retrofox self-assigned this Jan 11, 2024
Copy link
Contributor

Hi , @woocommerce/mothra

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented Jan 11, 2024

Test Results Summary

Commit SHA: 06239ff

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests27400502793m 39s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this tested well, but I noticed an issue with the discrepancy between the two data stores.
If I create a new product and click 'choose products for me' and then go to add specific categories and save the product and click 'choose products for me' I still get the same list, versus the new list that comes with the new categories.
I left an inline comment with some thoughts.


const relatedProducts = ( await getRelatedProducts(
productId
) ) as Product[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did notice one issue with this, for saving the product we use the core entity data store, but for this selector we are using our product data store. This means that when a user save the product by adding categories and then clicks getRelatedProducts we get the same result instead of the updated one's.

Should we either make use of the core entity data store as well? or add an invalidation method when we save the product, so we also invalidate our products data store?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️ looking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we can use the core store. Is the related prop (related_ids) exposes by code? Maybe we can tweak the selector deps to invalidate its data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use useEntityProp and get the related_ids that way

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @retrofox, this is testing well, nice work!

@retrofox retrofox merged commit 47e1f50 into trunk Jan 11, 2024
29 checks passed
@retrofox retrofox deleted the update/product-editor-add-choose-products-for-me-button branch January 11, 2024 20:33
@github-actions github-actions bot added this to the 8.6.0 milestone Jan 11, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Jan 11, 2024
@alopezari alopezari added needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: new product ux revamped product management experience needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris team: Mothra WC Merchants activation and store management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants