* Cart Link Block WIP
* Add pattern for header
* changelog
* We added a header so update test
* Add wc-blocks-header-pattern class
* render_woocommerce_template_part was missing wrappers
* Add missing class
* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Update plugins/woocommerce/src/Blocks/BlockTypes/CartLink.php
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Further SVG compression
* Remove unnecessary area handling
* Shared icon with mini cart
* Global style support
---------
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Remove product filters template part
* Remove product filters overlay template part
* Update e2e tests
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix linting
* Remove unused template part class and remove overlay navigation
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add To Cart Form: Improve the default style and add the Stepper style
* fix height button when no variation is selected
* not allow the user to set 0 as value of the input
* format css
* fix padding
* format css
* fix CSS
* unset margin to align with the button
* Fix quantity stepper layout
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* improve layout editor side
* remove not necessary changelog
* improve escaping
* fix webpack configuration
* add E2E tests
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
* Sample test
* Jest tests
* Fix spinner
* Add e2e test to check registration works
* Classes were renamed
* wc-block-order-confirmation--create-account-button remove double hyphen
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* woocommerce-blocks-test-enable-experimental-features
---------
Co-authored-by: github-actions <github-actions@github.com>
* Skip flaky tests for now
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Remove best selling filter option
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Add tiebreak fallback in case total_sales is 0 which prevents random order
* Remove test_merging_order_by_popularity_queries as it is not needed
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add order by sales filter option to product collection
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Replace __experimentalGetGlobalBlocksByName with stable getBlocksByName
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Force block to be inserted after account summary
* Clean up block hooks
* Changelog
* Escape strings in default content
* Init $notice to prevent PHP notice
* Fix WooCommerce Blocks storybook
* Add blocks storybook to main storybook
* Add post build for iframe.html
* Only add WooCommerce Blocks when building storybook
* Use manager file again and add blocks build for storybook build
* Add changelog
* Update heading for Hand-Picked collection
- Added 'recommend' to the keywords array.
- Changed heading content from 'Hand-Picked' to 'Recommended products'.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Only register block assets on the frontend during block render
* Add changelog entry
* Add wc-blocks-registry as a dependency to product collection tester script
* Update docs manifest
* darker outline and double outline on focus
* flip outlines for shipping selector
* fix select outline in dark mode
* Fix input labels being cut off due to line height
* adjust outline colors
* fix rest of problems in dark mode
* fix express payment on checkout
* Fix broken styles for shipping cart in medium
* Always center input label
* Fix order note background in dark mode
* remove empty space in payment methods when there's no content inside
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* fix linter issues
---------
Co-authored-by: github-actions <github-actions@github.com>
* Introduce RadioControl
* Provide better copy and improve styling of radio button
* Implement the logic of choosing current product as a reference
* Add placeholder state in product chooser
* Add placeholder image to product chooser
* Add changelog
* Refactor file
* Improve the condition choosing the default radio value
* Update E2E tests
* Format SVG icon and optimize it
* Increase a gap in radio control
* Make the labels less spcific to related products
* Rename some variables to more meaningful names
* Show placeholder img if product doesnt have one
* Fix type
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Fixed PHP 7.4 Compatibility
The splat operator does not support associative arrays until PHP 8.1.
* Added Related Products Collection Boilerplate
* Added `woocommerceRelatedTo` Collection Parameter
This parameter allows the block to query for products that are related
to the given product IDs.
* Added Collection Related Product Filter
Using `woocommerceRelatedTo`, queries may restrict the products returned
to those that are related to the given product ID(s).
* Removed Unnecessary Tracking
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Removing Misunderstood Option
* Linting Fix
* Fixed Test
* Initialize the Hand-Picked collection
* Removed Unnecessary Keyword
* Render the collection-specific control
* try removing for fixing gh syntax hl
* add back
* tweak icon render
* combine conditions for early return
* Remove timeFrame from the query
* Set control label per context
* Use primitives for the icon
* Hide 'order by' control for the Hand-Picked collection
* Support Unlimited `wc_get_related_products()`
This changes related product fetching so that `-1` will return all
related products. I also removed a second +10 offset that seems
to have been accidentally added eight years ago.
* Revert "Set control label per context"
This reverts commit cd537befbe.
* Update titles and description
* Enable sorting by entered order
* Removed `woocommerceRelatedTo` Param
Since we're going to use the collection name, we don't need
this functionality any longer.
* Simplified `post__in` Filtering
Since `merge_queries` was already using an intersection merge for
`post__in`, this second function is unnecessary. I've removed it
as well as refactored the merging logic.
* Pass Collection Name To Final Query
* Improve the query merging logic
* Added Custom Collection Handlers
Developers can register collections along with handlers that implement
the custom behavior.
* Removed Second Test Query Construction
As it was, `build_query_vars_from_query_block()` was triggering the
ProductCollection instance hooked into WordPress. After that, we
called `build_frontend_query()` on our test instance. This caused some
weird behavior in tests. As a result, however, the tax_query merge
test couldn't rely on the tax_query transformation done by WordPress.
* Added Related Product Collection Handlers
* Revert "Support Unlimited `wc_get_related_products()`"
This reverts commit 41c837202e.
* Fixed Preview Mode Query
It looks like we were checking the wrong place for the preview
state.
* Improve the query merging logic
* Fixed Test
* Updated Collection Heading
* Handle collection context / no results state
* Small cleanup
* Better Collection Test Teardown
Passing a callable back means that we can use variables in the
setUp and then the tearDown without any confusion.
* Removed Unnecessary Test Provider
* Fixed `$post__in` Merging
When the intersection is empty it was returning all products. This
makes it so that it returns nothing when there's no results.
* Set perPage to 0 and add Pagination block for better discoverability
* Improve empty state in Editor by providing meaningful instruction
* Make code more defensive
* Hide more filters in scope of handpicked through hideFilters API
* Fixed PHPDoc
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Hide Empty Related Product Collections
* Removed Duplicate Query Function
* Added Hand-Picked Collection Handler
* Revert changes to pnpm
* Improve comment for empty Hand-Picked collection
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix: Pagination not working on Frontend
Remove perPage and pages attributes from hand-picked collection
* Remove unused code
* Revert "Improve empty state in Editor by providing meaningful instruction"
This reverts commit 9ac5c20d5e.
* Do not apply layout styles for empty results
* Improve the wording on the empty results message
---------
Co-authored-by: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
* Fixed PHP 7.4 Compatibility
The splat operator does not support associative arrays until PHP 8.1.
* Added Related Products Collection Boilerplate
* Added `woocommerceRelatedTo` Collection Parameter
This parameter allows the block to query for products that are related
to the given product IDs.
* Added Collection Related Product Filter
Using `woocommerceRelatedTo`, queries may restrict the products returned
to those that are related to the given product ID(s).
* Removed Unnecessary Tracking
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Removing Misunderstood Option
* Linting Fix
* Fixed Test
* Removed Unnecessary Keyword
* Support Unlimited `wc_get_related_products()`
This changes related product fetching so that `-1` will return all
related products. I also removed a second +10 offset that seems
to have been accidentally added eight years ago.
* Removed `woocommerceRelatedTo` Param
Since we're going to use the collection name, we don't need
this functionality any longer.
* Simplified `post__in` Filtering
Since `merge_queries` was already using an intersection merge for
`post__in`, this second function is unnecessary. I've removed it
as well as refactored the merging logic.
* Pass Collection Name To Final Query
* Added Custom Collection Handlers
Developers can register collections along with handlers that implement
the custom behavior.
* Removed Second Test Query Construction
As it was, `build_query_vars_from_query_block()` was triggering the
ProductCollection instance hooked into WordPress. After that, we
called `build_frontend_query()` on our test instance. This caused some
weird behavior in tests. As a result, however, the tax_query merge
test couldn't rely on the tax_query transformation done by WordPress.
* Added Related Product Collection Handlers
* Revert "Support Unlimited `wc_get_related_products()`"
This reverts commit 41c837202e.
* Fixed Preview Mode Query
It looks like we were checking the wrong place for the preview
state.
* Fixed Test
* Updated Collection Heading
* Add Upsells collection definition
* Register Upsells
* Add collection handlers for Upsells
* Add changelog
* Remove on sale query param
* Better Collection Test Teardown
Passing a callable back means that we can use variables in the
setUp and then the tearDown without any confusion.
* Removed Unnecessary Test Provider
* Added Upsell Collection Unit Test
* Product ID Confidence Check
* Added Collection Product Reference
* Don't display Upsells collection if there's no upsells
* Change the Upsells collection heading
* Add Upsells supporting cart context
* Consume the cart productIds and display Upsells in there
* Fixed `$post__in` Merging
When the intersection is empty it was returning all products. This
makes it so that it returns nothing when there's no results.
* Fix lint
* Extract the variable
* Fix lint
---------
Co-authored-by: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Fixed PHP 7.4 Compatibility
The splat operator does not support associative arrays until PHP 8.1.
* Added Related Products Collection Boilerplate
* Added `woocommerceRelatedTo` Collection Parameter
This parameter allows the block to query for products that are related
to the given product IDs.
* Added Collection Related Product Filter
Using `woocommerceRelatedTo`, queries may restrict the products returned
to those that are related to the given product ID(s).
* Removed Unnecessary Tracking
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Removing Misunderstood Option
* Linting Fix
* Fixed Test
* Removed Unnecessary Keyword
* Support Unlimited `wc_get_related_products()`
This changes related product fetching so that `-1` will return all
related products. I also removed a second +10 offset that seems
to have been accidentally added eight years ago.
* Removed `woocommerceRelatedTo` Param
Since we're going to use the collection name, we don't need
this functionality any longer.
* Simplified `post__in` Filtering
Since `merge_queries` was already using an intersection merge for
`post__in`, this second function is unnecessary. I've removed it
as well as refactored the merging logic.
* Pass Collection Name To Final Query
* Added Custom Collection Handlers
Developers can register collections along with handlers that implement
the custom behavior.
* Removed Second Test Query Construction
As it was, `build_query_vars_from_query_block()` was triggering the
ProductCollection instance hooked into WordPress. After that, we
called `build_frontend_query()` on our test instance. This caused some
weird behavior in tests. As a result, however, the tax_query merge
test couldn't rely on the tax_query transformation done by WordPress.
* Added Related Product Collection Handlers
* Revert "Support Unlimited `wc_get_related_products()`"
This reverts commit 41c837202e.
* Fixed Preview Mode Query
It looks like we were checking the wrong place for the preview
state.
* Fixed Test
* Updated Collection Heading
* Better Collection Test Teardown
Passing a callable back means that we can use variables in the
setUp and then the tearDown without any confusion.
* Removed Unnecessary Test Provider
* Fixed `$post__in` Merging
When the intersection is empty it was returning all products. This
makes it so that it returns nothing when there's no results.
* Fixed PHPDoc
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Hide Empty Related Product Collections
* Fix lint issue
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Settings first pass
* New Settings UI
* Respect woocommerce_enable_delayed_account_creation at block level
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Check input exists
* Add new setting to tests
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update form handling to work with automatically generated passwords
* Keep user logged in after password reset.
* Ignore comments for hooks in changed method
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Checkmark list style
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add new buttonAttributes API to style express checkout buttons coherently (#47899)
* Expose buttonAttributes to the express payment methods
* Add size and label attributes to the express checkout area
* Remove defaultHeight
* default button Label
* Remove the button label attribute
* Remove px from height
* Change large button height to 55px
* Load express checkout block with attributes
* Add toggle and borderRadius controls and remove getting border radius from the theme
* Remove extra border radius text
* Only pass buttonAttributes if toggled on
* Move express payment block attribute logic into a Provider
* Tidy up editor grid and parse attributes into context on frontend
* Add px to border-radius input
* Express payment methods not selectable
* Add a test
* lint fixes
* default button height is 48 not 4
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update docs
* Add tests for express payment methods
* Center images within the express payment area in the editor
* Apply the buttonAttributes to the li container in the editor regardless of showButtonStyles
* Fix style issue
* fix linting
* fix lint again
* Update manifest
* Update docs manifest
* Resize images in editor
* lint fix
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Synchronise the express payment settings between the Cart & Checkout blocks (#50688)
* Add express payment methods to sidebar
* Only add extra props for express payment methods
* Update docs
* Make title, description and gatewayId types optional
* Update docs
* Fix types again and editor side
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* handle situation when no methods are active
* Update manifest
* Add express payment methods to inspector controls for express checkout block (#50983)
* Remove forced styles on the editor
* Remove the darkMode setting from the buttonAttributes API (#51109)
* Remove darkMode from the buttonAttributes API
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Accept supports declarations for express payment style controls + merchant ux improvements in the editor (#51296)
* Fix images in editor displaying weird
* Fix long express payment names breaking layout
* Default to uniform styles off
* Use heightControl for border radius and fix height for cart buttons
* Move formatting title and description to the config validation
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix linting
* Fix failing test
* Add back the 48px height for images in editor
* Fix linting again
* Update docs
* Update docs manifest
* Update docs to fix linting
* Add comment to test to better explain why we are expecting a console warning
* make strings translatable
* Sync cart & checkout directly without option
* Remove current styles
* Change the beta label
* Replace < and > with symbol references in docs
* Update docs manifest
* Increase padding of beta label
* fix linter issues
* change to using looger helper
* fix CSS
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Skip top flaky tests
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
* fix line height
* Support controlling address card from data store
* expand billing address on unsync
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* disable linter rule
* remove empty section
* remove used vars
---------
Co-authored-by: github-actions <github-actions@github.com>
* Initial implementation of the missing product state
- Changed `getProductCollectionUIStateInEditor` to a hook `useProductCollectionUIState`.
- As we added logic to check if selected product reference is deleted which require making an API call. Therefore, I decided to use a hook.
- While making an API call to check if product reference is deleted, I decided to show spinner in the block.
- Introduced new UI state `DELETED_PRODUCT_REFERENCE` to handle the missing product state.
- Updated existing `ProductPicker` component to handle the new UI state.
- It's better to use existing component for the missing product state, as it already has all the required UI.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Use getEntityRecord to check if product exists and other improvements
* Remove console log
* Add E2E tests for deleted product reference in Product Collection block
This commit introduces new E2E tests to verify the behavior of the Product
Collection block when dealing with deleted product references. The changes
include:
1. New test suite in register-product-collection-tester.block_theme.spec.ts
2. Modification to product-collection.page.ts to support custom product selection
3. Minor update to utils.tsx to handle trashed products
These tests ensure that the Product Collection block correctly handles
scenarios where referenced products are deleted, trashed, or restored,
improving the overall reliability of the feature.
* Simplify product creation in Product Collection block test
* Refactor E2E test for delete product reference picker
1. Removing the unnecessary `test.describe` block for "Deleted product reference"
2. Eliminating the `beforeEach` hook that was creating a test product
3. Integrating the test product creation directly into the main test
This change simplifies the test structure and improves readability while
maintaining the same test coverage for the Product Collection block's
behavior when dealing with deleted or unavailable products.
* Simplify logic for product collection UI state
This commit simplifies the handling of the `usesReference` prop in the
Product Collection block:
1. In `edit/index.tsx`, directly pass `usesReference` to
`useProductCollectionUIState` hook without conditional spreading.
2. In `utils.tsx`, update the type definition of `usesReference` in the
`useProductCollectionUIState` hook to explicitly include `undefined`.
* Refactor Product Collection block to improve prop passing
- Introduce ProductCollectionContentProps type for better prop management
- Refactor Edit component to use a renderComponent function
- Update component prop types to use more specific props
- Remove unnecessary props from ProductCollectionEditComponentProps
- Simplify component rendering logic in Edit component
- Adjust ProductPicker to receive only required props
- Update imports and prop types in various files to use new types
This refactoring improves code organization and reduces prop drilling by
only passing necessary props to each component. It enhances maintainability
and readability of the Product Collection block and related components.
* Refactor Product Collection block editor UI state handling
This commit simplifies the rendering logic in the Product Collection block's
Edit component. It removes a redundant case for the VALID state, as both
VALID and VALID_WITH_PREVIEW states now render the same ProductCollectionContent
component. This change improves code maintainability and reduces duplication.
* Fix: isDeletedProductReference is not set correctly
* Use "page.reload" instead of "admin.page.reload"
* Separate PRODUCT_REFERENCE_PICKER and DELETED_PRODUCT_REFERENCE cases
This improves readability and maintainability of the switch statement.
---------
Co-authored-by: github-actions <github-actions@github.com>
* reset styles for panel button
* reset styles for address card edit and address line 2
* Update shipping selector buttons
* fix line height
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* remove extra styles no longer needed
* update styles to balance chevron and change to span
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
* update Mongolia postcode to be 5 digits instead of 6
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* update validation package and expand mongolia checks
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* update lock
* fix lock again
---------
Co-authored-by: github-actions <github-actions@github.com>