Skip to content

Conversation

@joshuatf
Copy link
Contributor

@joshuatf joshuatf commented Dec 7, 2022

All Submissions:

Changes proposed in this Pull Request:

Adds the variations list to the new product experience.

Note that this PR does not address persistence of ordering for variations or any other updates. Those will be handled in a follow-up.

Screen Shot 2022-12-07 at 11 50 36 AM

Closes #35772 .

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Add a product with variations using the old product experience
  2. Navigate to that product in the new experience. E.g., wp-admin/admin.php?page=wc-admin&path=/product/{product_id}
  3. Click on "Options"
  4. Note that the variations section exists with the correct text and a working link
  5. Note that variations show a spinner until variations are loaded
  6. Note that variations appear with their attributes, price, and stock status listed

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 created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

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.

@joshuatf joshuatf requested a review from a team December 7, 2022 19:57
@joshuatf joshuatf self-assigned this Dec 7, 2022
@github-actions github-actions bot added focus: react admin package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Dec 7, 2022
@@ -0,0 +1,39 @@
.woocommerce-product-variations {
min-height: 300px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this is temporary and height will be adjusted further in #35789.

@@ -0,0 +1,49 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully this util isn't pushing the scope of this PR too far. Happy to separate it into another PR if it helps.

};
} );

if ( ! variations || isLoading ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the current behavior is odd because some products don't have variations. Automatic generation of variations will address this and hopefully guarantee that a variation always exists if any options exist.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

Test Results Summary

Commit SHA: 7be839e

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 49s
E2E Tests187006019318m 1s

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.

@octaedro octaedro requested review from octaedro and removed request for a team December 13, 2022 11:36
* Get the product stock quantity or stock status label.
*
* @param product Product instance.
* @return {PRODUCT_STOCK_STATUS_KEYS} Product staus key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Two nitpick things:

  • There is a typo in staus.
  • Since we can also return a number, I think that this line should be like this:
@return {PRODUCT_STOCK_STATUS_KEYS|number} Product stock quantity or product status key.

Copy link
Contributor

@octaedro octaedro left a comment

Choose a reason for hiding this comment

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

Good job @joshuatf! This is testing well and the code looks good.
I just left a small comment, and it seems like there are a few small lint errors as well.

Base automatically changed from add/35706 to trunk December 13, 2022 16:13
Copy link
Contributor

@octaedro octaedro left a comment

Choose a reason for hiding this comment

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

Nice job @joshuatf! LGTM :shipit:

@joshuatf joshuatf merged commit e1aabf2 into trunk Dec 13, 2022
@joshuatf joshuatf deleted the add/35772 branch December 13, 2022 23:29
@github-actions github-actions bot added this to the 7.3.0 milestone Dec 13, 2022
samueljseay pushed a commit that referenced this pull request Dec 15, 2022
)

* Add product variations section

* Add variations list

* Add util to get product stock status

* Add variation specific attribute type

* Add currency code to header column

* Fix up variations header width

* Add variations loading state

* Add changelog entries

* Convert spaces to tabs

* Fix status typo

* Fix up return type for stock status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render product variations list

3 participants