-
Notifications
You must be signed in to change notification settings - Fork 220
Conversation
This will be used to render the local pickup options and also display a title if there are more than one package (e.g. if WC subs adds them)
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +15.7 kB (+1%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
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.
Hello @opr! Thank you for working on this PR! I only have one question that you kind check below!
} } | ||
selected={ selectedOption } | ||
options={ pickupLocations.map( ( location ) => | ||
renderPickupLocation( location, pickupLocations.length ) |
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.
I believe we should check the length of the shippingRates
instead of pickupLocations
, the same in this line: https://github.com/woocommerce/woocommerce-blocks/blob/trunk/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx#L152
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.
Hey @tarhi-saad I updated some internal testing notes and added one to test for this. Thanks for spotting it!
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.
Thank you, @opr, for the changes! Everything works as expected! 🙌 There is just one minor TS error in the unit tests file (see the message below). And I have some questions/suggestions about the internal testing notes:
- In
step 1
, we ask to remove theRadioControl
rendered byBlock
. But it's already replaced in the last commit: Add packageCount as an option to LocalPickupSelect - I added
packageCount={ shippingRates.length }
to the code snippet fromstep 1
- In
step 8
, I replaceddepending on what you entered in step 1
withdepending on what you entered in step 7
selectedOptionOverride?: null | ( ( value: string ) => void ); | ||
onSelectRateOverride?: null | ( ( value: string ) => void ); | ||
} ) => ( | ||
<LocalPickupSelect |
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.
We have a TS error here: Property 'packageCount' is missing
Hey @tarhi-saad thanks for the review, ok in 10b1dc9 the component was not supposed to change, that's my bad! I will revert it so the testing instructions make sense. I'll also address that TS issue. Thanks! |
This PR is part of #7998. I am splitting the work up so it is easier to review. There will be a followup where this component is actually used and passed through to Slot/Fill.
This PR adds a new component,
LocalPickupSelect
(and unit tests for it) which incorporates the existingRadioControl
but wraps it in a div and outputs an optional title (if one is supplied).This component is required because when showing multiple packages in WC Subscriptions, it is helpful to know the names of the packages.
Without this PR, WC subs would need to render a
RadioControl
and title separately, resulting in a poorer DX.This change also allows us to have a focused and dedicated component for displaying pickup rates, which is more explicitly named, making it easier to reason with in future.
Testing
Automated Tests
User Facing Testing
Internal testing notes
assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx
and remove theRadioControl
rendered byBlock
and replace it with:WooCommerce -> Settings -> Shipping -> Local pickup
, add a cost for local pickup on theAdd a price for customers who choose local pickup
option.WooCommerce -> Settings -> Multiple Packages
and enable it. In the "Group by" option, choose "Product (individual)`. Save the settings.$5.00 x 5 packages
(the numbers will be different for you depending on what you entered in step 7, and how many items are in your cart).WooCommerce Visibility
Changelog