Skip to content

Conversation

@joelclimbsthings
Copy link
Contributor

@joelclimbsthings joelclimbsthings commented Apr 25, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Adding "create new shipping class" option in Shipping class dropdown on product block editor, as well as modal.

Closes #37886 .

How to test the changes in this Pull Request:

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

  1. Checkout branch and enable product-block-editor feature flag with the WCA Test Helper plugin.
  2. Navigate to Products -> Add new, and you should see the product block editor.
  3. Navigate to Shipping tab, and select "Follow class" under "Shipping fee" heading.
  4. This should reveal a drop-down menu with a list of any shipping classes.
  5. Click "Add new shipping class" within the drop-down, which should reveal the shipping class modal.
  6. Fill out the modal form with a shipping class and hit "Add"
  7. This should add the shipping class and select it within the drop-down.
  8. Save the product, and refresh to ensure the value persists.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 25, 2023

Test Results Summary

Commit SHA: 442b974

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 52s
E2E Tests1870010019717m 57s

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.

@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #37968 (fff60ec) into trunk (7a63646) will decrease coverage by 0.2%.
The diff coverage is 14.3%.

❗ Current head fff60ec differs from pull request most recent head 442b974. Consider uploading reports for the commit 442b974 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             trunk   #37968     +/-   ##
==========================================
- Coverage     51.5%    51.2%   -0.2%     
- Complexity   17281    17409    +128     
==========================================
  Files          430      440     +10     
  Lines        80030    80576    +546     
==========================================
+ Hits         41215    41295     +80     
- Misses       38815    39281    +466     
Impacted Files Coverage Δ
...mmerce/includes/admin/class-wc-admin-importers.php 0.0% <0.0%> (ø)
...merce/includes/admin/class-wc-admin-post-types.php 9.5% <0.0%> (ø)
...rters/class-wc-product-csv-importer-controller.php 35.3% <0.0%> (-0.1%) ⬇️
...ugins/woocommerce/includes/class-wc-post-types.php 1.0% <0.0%> (-0.1%) ⬇️
...ludes/tracks/events/class-wc-importer-tracking.php 0.0% <0.0%> (ø)
...ludes/wccom-site/class-wc-wccom-site-installer.php 0.0% <0.0%> (ø)
...ation/class-wc-wccom-site-installation-manager.php 0.0% <0.0%> (ø)
...class-wc-wccom-site-installation-state-storage.php 0.0% <0.0%> (ø)
...llation/class-wc-wccom-site-installation-state.php 0.0% <0.0%> (ø)
...-wccom-site-installation-step-activate-product.php 0.0% <0.0%> (ø)
... and 16 more

... and 1 file with indirect coverage changes

@joelclimbsthings joelclimbsthings requested a review from a team April 25, 2023 19:50
@joelclimbsthings joelclimbsthings marked this pull request as ready for review April 25, 2023 19:50
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 25, 2023
@joelclimbsthings joelclimbsthings force-pushed the add/shipping-class-creation-37886 branch from fd52b8b to 1412686 Compare April 25, 2023 21:14
louwie17
louwie17 previously approved these changes Apr 28, 2023
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.

Nice work @joelclimbsthings, this tested well! Although I did encounter a strange problem with the No shipping class option, where it auto selected the free shipping after selecting that.
I assume this was slightly un-expected behaviour after adding the No shipping class option? This could be addressed in a follow up, it seemed like the rest tested fine.

const FREE_SHIPPING_OPTION_VALUE = 'free_shipping';

export const DEFAULT_SHIPPING_CLASS_OPTIONS: SelectControl.Option[] = [
{ value: '', label: __( 'No shipping class', 'woocommerce' ) },
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like when we select this now, the Free Shipping button gets auto selected. Is this what we decided on?
It feels kinda strange, maybe we want to update that useEffect on line 174 to fix this.

@joelclimbsthings joelclimbsthings force-pushed the add/shipping-class-creation-37886 branch from 6a36360 to 68016b8 Compare April 28, 2023 17:10
@joelclimbsthings
Copy link
Contributor Author

Thanks for the review @louwie17 . When I saw that behavior I made the assumption that it was expected since it's an invalid state, but on second though it is odd, so I've removed it in 68016b8.

I also had to rebase, but that's the extent of the changes. Let me know what you think.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 28, 2023

Hi @louwie17, @joshuatf,

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

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Left one comment about a translatable string and then same question as @louwie17 on the behavior.

@joelclimbsthings
Copy link
Contributor Author

Thanks @joshuatf , I believe I'd already removed that behavior in 68016b8 as mentioned here. Was there something different happening?

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.

This tested well this time around, nice work @joelclimbsthings 👍

I did notice that No shipping class is shown as an invalid option, disabling the form:
Screenshot 2023-05-01 at 12 01 48 PM
This is not a blocker for me in this PR, but curious if that was the expected behaviour we intended? cc: @jarekmorawski

@joelclimbsthings
Copy link
Contributor Author

Thanks @louwie17 , I assumed this was correct when "follow class" selected under shipping fee, since it wouldn't make sense if no shipping class is selected. Definitely up to change via a follow-up pending @jarekmorawski 's thoughts!

@joelclimbsthings joelclimbsthings merged commit 16b9191 into trunk May 1, 2023
@joelclimbsthings joelclimbsthings deleted the add/shipping-class-creation-37886 branch May 1, 2023 17:04
@github-actions github-actions bot added this to the 7.8.0 milestone May 1, 2023
lanej0 pushed a commit that referenced this pull request May 1, 2023
@rodelgc
Copy link
Contributor

rodelgc commented May 29, 2023

Updated testing instructions for this PR:

  1. Checkout branch and enable product-block-editor feature flag with the WCA Test Helper plugin.
  2. Navigate to Products -> Add new, and you should see the product block editor.
  3. Navigate to Shipping tab, and click on the "Shipping class" menu.
  4. This should reveal a drop-down menu with a list of any shipping classes.
  5. Click "Add new shipping class" within the drop-down, which should reveal the shipping class modal.
  6. Fill out the modal form with a shipping class and hit "Add"
  7. This should add the shipping class and select it within the drop-down.
  8. Save the product, and refresh to ensure the value persists.

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.

Product Block Editor: Allow creation of shipping class

5 participants