Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Honor hidden property of cart item data and add support for experimenal property #3732

Merged
merged 6 commits into from Jan 26, 2021

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Jan 25, 2021

This PR makes it so:

  • If a cart item data has the hidden property set to true, it will be hidden.
  • hidden can be overridden with the __experimental_woocommerce_blocks_hidden property, which only has effect in blocks.

Screenshots

imatge

imatge

How to test the changes in this Pull Request:

  1. Checkout fix/details-disappearing branch in WC Subscriptions (see relevant PR: 3968-gh-woocommerce/woocommerce-subscriptions).
  2. Add a subscription with free trial and signup fee to your cart.
  3. Go to the Cart block and verify the free trial and signup fee details are rendered.
  4. Open the Cart shortcode and verify free trial and signup fee metadata is not rendered.

Changelog

Hidden cart item meta data will not be rendered in the Cart and Checkout blocks.

@Aljullu Aljullu added status: needs review category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. labels Jan 25, 2021
@Aljullu Aljullu added this to the 4.4.0 milestone Jan 25, 2021
@Aljullu Aljullu self-assigned this Jan 25, 2021
@Aljullu Aljullu requested a review from a team as a code owner January 25, 2021 13:52
@Aljullu Aljullu requested review from opr and removed request for a team January 25, 2021 13:52
@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2021

Size Change: -3.77 kB (0%)

Total Size: 1.18 MB

Filename Size Change
build/all-products.js 36 kB +2 B (0%)
build/all-reviews.js 9.88 kB -2 B (0%)
build/atomic-block-components/add-to-cart--atomic-block-components/button.js 3.34 kB +1 B (0%)
build/atomic-block-components/add-to-cart.js 7.7 kB -1 B (0%)
build/atomic-block-components/button.js 838 B +1 B (0%)
build/atomic-block-components/image.js 1.13 kB -2 B (0%)
build/atomic-block-components/price.js 1.85 kB +1 B (0%)
build/atomic-block-components/rating.js 525 B +1 B (0%)
build/atomic-block-components/sku.js 393 B -1 B (0%)
build/atomic-block-components/stock-indicator.js 572 B -1 B (0%)
build/atomic-block-components/tag-list.js 472 B +1 B (0%)
build/attribute-filter.js 12.5 kB -1 B (0%)
build/blocks.js 3.49 kB -3 B (0%)
build/cart-frontend.js 63.7 kB +32 B (0%)
build/cart.js 34.2 kB +47 B (0%)
build/checkout-frontend.js 89.4 kB +28 B (0%)
build/checkout.js 39.9 kB +43 B (0%)
build/featured-category.js 7.81 kB -3 B (0%)
build/featured-product.js 10 kB -2 B (0%)
build/handpicked-products.js 7.49 kB -3 B (0%)
build/price-filter.js 9.92 kB +1 B (0%)
build/product-best-sellers.js 7.57 kB +1 B (0%)
build/product-category.js 8.51 kB -2 B (0%)
build/product-new.js 7.74 kB -1 B (0%)
build/product-on-sale.js 8.12 kB +4 B (0%)
build/product-search.js 3.56 kB +1 B (0%)
build/product-tag.js 6.56 kB +1 B (0%)
build/product-top-rated.js 7.7 kB -2 B (0%)
build/products-by-attribute.js 8.49 kB +1 B (0%)
build/reviews-by-category.js 11.9 kB -1 B (0%)
build/reviews-by-product.js 13.5 kB +4 B (0%)
build/single-product.js 10.3 kB +4 B (0%)
build/vendors.js 431 kB -3.92 kB (-1%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 8.32 kB 0 B
build/active-filters.js 8.49 kB 0 B
build/all-products-frontend.js 34.7 kB 0 B
build/atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title.js 336 B 0 B
build/atomic-block-components/add-to-cart-frontend.js 9.2 kB 0 B
build/atomic-block-components/button-frontend.js 2.35 kB 0 B
build/atomic-block-components/category-list-frontend.js 469 B 0 B
build/atomic-block-components/category-list.js 476 B 0 B
build/atomic-block-components/image-frontend.js 1.68 kB 0 B
build/atomic-block-components/price-frontend.js 1.83 kB 0 B
build/atomic-block-components/rating-frontend.js 521 B 0 B
build/atomic-block-components/sale-badge-frontend.js 859 B 0 B
build/atomic-block-components/sale-badge.js 862 B 0 B
build/atomic-block-components/sku-frontend.js 389 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 569 B 0 B
build/atomic-block-components/summary-frontend.js 918 B 0 B
build/atomic-block-components/summary.js 926 B 0 B
build/atomic-block-components/tag-list-frontend.js 467 B 0 B
build/atomic-block-components/title-frontend.js 1.35 kB 0 B
build/atomic-block-components/title.js 1.21 kB 0 B
build/attribute-filter-frontend.js 18.2 kB 0 B
build/blocks-checkout.js 50.1 kB 0 B
build/editor-rtl.css 14.9 kB 0 B
build/editor.css 14.9 kB 0 B
build/price-filter-frontend.js 14.5 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/reviews-frontend.js 9.51 kB 0 B
build/single-product-frontend.js 37.9 kB 0 B
build/style-rtl.css 18.7 kB 0 B
build/style.css 18.7 kB 0 B
build/vendors--atomic-block-components/price-frontend.js 5.73 kB 0 B
build/vendors-style-rtl.css 1.05 kB 0 B
build/vendors-style.css 1.05 kB 0 B
build/wc-blocks-data.js 6.97 kB 0 B
build/wc-blocks-middleware.js 935 B 0 B
build/wc-blocks-registry.js 2.54 kB 0 B
build/wc-payment-method-bacs.js 775 B 0 B
build/wc-payment-method-cheque.js 771 B 0 B
build/wc-payment-method-cod.js 866 B 0 B
build/wc-payment-method-paypal.js 813 B 0 B
build/wc-payment-method-stripe.js 12.1 kB 0 B
build/wc-settings.js 2.4 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.68 kB 0 B

compressed-size-action

Copy link
Contributor

@opr opr left a comment

Choose a reason for hiding this comment

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

Tests great, approving 👌🏼 I left a comment, feel free to address it if you think it is necessary to do so.

@@ -12,6 +12,8 @@ import './style.scss';

// Component to display cart item data and variations.
const ProductDetails = ( { details = [] } ) => {
details = details.filter( ( detail ) => ! detail.hidden );
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we worried about checking if details is arraylike here? I know it defaults to one, but what if a non-arraylike is passed in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I also took the chance to add snapshot testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! This looks great now 🙌🏻

@Aljullu Aljullu merged commit 689180a into trunk Jan 26, 2021
@Aljullu Aljullu deleted the fix/meta-data-hidden branch January 26, 2021 14:50
@mikejolley mikejolley added the type: bug The issue/PR concerns a confirmed bug. label Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants