Skip to content

Conversation

@chihsuan
Copy link
Member

@chihsuan chihsuan commented Apr 28, 2022

All Submissions:

Changes proposed in this Pull Request:

Closes #32412.

Add feature to load sample products.

Apr-29-2022 14-24-12

How to test the changes in this Pull Request:

  1. Open the plugins/woocommerce/client/admin/config/development.json and change experimental-products-task & experimental-import-products-task to true
  2. Run pnpm nx start woocommerce-admin

Add products view

  1. Go to WooCommerce > Home & click the "Add my products" task
  2. Click "Load Sample Products"
  3. Observe that 9 products are loaded, and a notice is displayed
  4. Click "Continue setting up your store" -> should redirect to WooCommerce home
  5. Change SHOW_STACK_LAYOUT to false here.
  6. Go to WooCommerce > Home & click the "Add my products" task
  7. Click "View more product types"
  8. Click the "CAN’T DECIDE?" card
  9. Observe that 9 products are loaded, and a notice is displayed
  10. Click "Continue setting up your store" -> should redirect to WooCommerce home

Import products view

  1. Start OBW.
  2. Choose Yes, on another platform in the Business Details step.
  3. Navigate to WoocCommerce -> Home and click Add my products
  4. Click "Or add your products from scratch"
  5. Click "Load Sample Products"
  6. Observe that 9 products are loaded, and a notice is displayed
  7. Click "Continue setting up your store" -> should redirect to WooCommerce home

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file by running pnpm nx affected --target=changelog?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@chihsuan chihsuan changed the base branch from trunk to add/32634-add-products-task April 28, 2022 09:30
@chihsuan chihsuan self-assigned this Apr 28, 2022
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from 6c05497 to 02194b7 Compare April 28, 2022 09:51
@chihsuan chihsuan force-pushed the add/32634-add-products-task branch from 396b863 to 1d0689b Compare April 28, 2022 10:11
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch 3 times, most recently from d346564 to 6ef82a7 Compare April 28, 2022 14:07
@chihsuan chihsuan force-pushed the add/32634-add-products-task branch from 1663360 to 345a2ed Compare April 29, 2022 02:47
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from 6ef82a7 to 692fd92 Compare April 29, 2022 02:59
Base automatically changed from add/32634-add-products-task to trunk April 29, 2022 03:35
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from 692fd92 to 1d364fa Compare April 29, 2022 04:05
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 29, 2022
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch 3 times, most recently from 9374f7c to 5e6511b Compare April 29, 2022 04:54
*/
import { __ } from '@wordpress/i18n';
import { Modal } from '@wordpress/components';
import { Spinner } from '@wordpress/components/build/ui';
Copy link
Member Author

@chihsuan chihsuan Apr 29, 2022

Choose a reason for hiding this comment

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

import { Spinner } from '@wordpress/components/ui'; <- This doesn't work because ui doesn't export in @wordpress/components's index.js

@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from cf8839b to 4f239fc Compare April 29, 2022 06:51
@chihsuan chihsuan marked this pull request as ready for review April 29, 2022 07:20
@chihsuan chihsuan requested a review from a team April 29, 2022 07:22
@chihsuan chihsuan marked this pull request as draft May 3, 2022 03:52
@chihsuan
Copy link
Member Author

chihsuan commented May 3, 2022

Converted this to the draft. I'll need to make some changes once #32835 is merged.

@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from 4f239fc to a76e09e Compare May 4, 2022 02:35
@chihsuan chihsuan force-pushed the add/32412-load-sample-products branch from a76e09e to a4bd70c Compare May 4, 2022 02:42
@chihsuan chihsuan marked this pull request as ready for review May 4, 2022 02:51
new WooCommerceDependencyExtractionWebpackPlugin(),
new WooCommerceDependencyExtractionWebpackPlugin( {
requestToExternal( request ) {
if ( request === '@wordpress/components/build/ui' ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We have three different Spinner components:

And we need to use the one from @wordpress/components/ui/spinner, but it's not included in external wp.components.

Copy link
Contributor

@moon0326 moon0326 left a comment

Choose a reason for hiding this comment

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

Worked perfectly! 👍

LGTM and tested well 🚀

@chihsuan chihsuan merged commit ce253ca into trunk May 6, 2022
@chihsuan chihsuan deleted the add/32412-load-sample-products branch May 6, 2022 01:23
@github-actions github-actions bot added this to the 6.6.0 milestone May 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2022

Hi @chihsuan, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task List: Add Products Task - Load sample products feature

3 participants