* Add a retry mechanism to obtain the lock for inserting products through the API (#51735)
* Add a retry mechanism to the query to obtain the lock for inserting products in the API
* Add changefile(s) from automation for the following project(s): woocommerce
* Log errors after failed attempts and delay 10ms for each attempt
* Fix lint
---------
Co-authored-by: github-actions <github-actions@github.com>
* Prep for cherry pick 51735
---------
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
* Show correct decimals on product price and show the sale price of products (#51499)
* add regular price and sale price flag to product apis and types
* add sale price and screen reader text for prices on product cards
* fix typo on sale flag
* add regular price and sale price flag to product apis and types
* add sale price and screen reader text for prices on product cards
* fix typo on sale flag
* Changelog.
* address feedback on sale price VO text
---------
Co-authored-by: Herman <KokkieH@users.noreply.github.com>
Co-authored-by: And Finally <andfinally@users.noreply.github.com>
* Prep for cherry pick 51499
---------
Co-authored-by: Raja sekar <raja.sekar.manimaran@automattic.com>
Co-authored-by: Herman <KokkieH@users.noreply.github.com>
Co-authored-by: And Finally <andfinally@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
* Add BFCM promo (#51739)
* Populate `window.wcMarketplace` for Marketing > Coupons
* TEST CODE: Add promotions dummy data to the endpoint for now
See [this comment](https://github.com/Automattic/woocommerce.com/issues/21783#issuecomment-2376471712) as to how we plan to manage this through WCCOM
* Initial implementation of the `<PromoCard>` component
This commit does the following:
- Implement the `PromoCard` component
- Refactor the existing `Promotions` component
- Extract types
- Add support for conditional rendering based on `pathname`
- Accept optional parameter `promoCardOnly`
- Renders `PromoCard` wherever needed, as requested in the project thread.
Some remaining TODOs:
1. Dismiss functionality
2. Tracking
3. Figma design adjustments
- CSS styling (Flexbox in Marketplace, etc.)
- Percent image, wherever needed
- Background image
4. BWC testing (e.g. ensuring that "Get more for your money" banner still works)
* Make sure that WCCOM also returns path so that earlier versions of in-app marketplace don't break (path undefined error)
* Update T&C link
After https://github.com/Automattic/woocommerce.com/issues/21840
* Implement promo banner dismissal logic and tracks
* Styling the WooCommerce > Extensions version of the promo component.
- Tweaked data on `class-wc-admin-assets.php` to pass `style` and `icon` attributes for that promo.
- Moved promo on this page from the marketplace `Header` component to the `Content`, above the Sales Banner notices.
- Deleted `percent.svg` and moved its content into a React component.
- CSS tweaks for this style of promo.
- Changes to elements of `PromoCard` component to allow the layout for this style.
* Fixed some TypeScript issues.
- Added guard condition in case `promotion.id` is undefined.
- Returning null if it isn't - but below `useState` hook, so we conform to rules of hooks.
- Setting default value for `promotion.cta_label` to satisfy TypeScript, which expects a node.
Style tweaks to `.promo-cta`. Vertical centering of text, hover colour, margins.
* Remove unnecessary unique identifier for each promo, and use a smarter way (URIs) to gather the visibility data
* Lint
* Revert test code
* Changelog
* Better code comments
* Changed `promoCardOnly` attribute of `Promotions` to `format`, to allow for more types in future.
* Update plugins/woocommerce-admin/client/marketplace/components/promotions/promotions.tsx
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
* Styling promo cards at different breakpoints.
Moved homescreen promo to after store management links.
* Added condition to merge array of promos with the main `$promotions` array.
* Added `useEffect` so we only record Track event for view of promotion once.
Changed Tracks prefix to the shorter `marketplace_promo_`.
* Added Tracks events for both formats of promotions, `promo-card`, and the original `notice`.
* Merging two style blocks.
* Passing `format` to `recordEvent` instead of hard-coding it.
* Addressing linter errors.
* Moved operation merging promos into the main array into a separate method for greater clarity.
* Moved Promotions component on WooCommerce > Home to below task list.
* Styling tweaks.
Increased schedule of `woocommerce_marketplace_cron_fetch_promotions` cron job to twice daily.
Added guard conditions in `Promotions` in case `window.wcMarketplace.promotions` isn't defined or isn't an array.
* Reduced SVG size to 72px.
* Fixing linter error.
* Style tweaks. Using WP components colour vars for CTA and dismiss links.
* Fixing linter error.
* Reverting change to `schedule_cron_event`, as this method will not be present if only this branch is cherry-picked.
---------
Co-authored-by: And Finally <andfinally@users.noreply.github.com>
* Prep for cherry pick 51739
---------
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
Co-authored-by: And Finally <andfinally@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
* Revert "CYS - Move the `private/patterns` endpoint to woocommerce admin API (#50400)"
This reverts commit 091141218e.
* Revert "CYS - Move the `ai/products` endpoint to woocommerce admin API (#50396)"
This reverts commit ae6f7837b2.
* fix endpoint
* Add changefile(s) from automation for the following project(s): woocommerce
* fix e2e test
* add declare strict type declaration
* Remove old TODO comment
* Add strict_types to Products route class file
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
* Add core feature for site visibility badge (#51664)
* Add site_visibility_badge feature
* Update feature check on badge
Previously the WooCommerce Admin LYS feature flag was used, however this is slated to be removed in an upcoming release. This is updated to use the core level feature flag for the badge.
* Add changelog
* Fix lint issues
* Revert "Fix lint issues"
This reverts commit cf05d2b74f.
* Lint fixes
* lint
* Prep for cherry pick 51664
---------
Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
* Check if the cart needs shipping before validating shipping address
* Add test to ensure placing an order with a virtual product works
* Test for physical, but downloadable product shipping requirement
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Update Payments menu item display and linking behavior (#51541)
* Minor cleanup
* refact: Rename must_be_visible to is_incentive_visible for clarity
* refact: Rename register_payments_welcome_page to register_menu_and_page for clarity
* Don't show the incentive page if the user can't manage WC
* Introduce menu item when no incentive
* Don't recommend additional gateways when WCPay is present
* Render gateway suggestions on the WCPay task page, also
* Add changelog entry
* Remove short array syntax
* Lint fixes
* Simplify Payments task view logic
* Simplify WooPayments task view logic
* Improve WooPayments task complete logic
* WooPayments can't be connected or onboarded if it is not active
* refact: Rename private static method
* Improve logic to determine the Payments task slug by factoring in the extended task list also
* docs: Add details about our use of the Payments task logic
* Add type hint
* Do not recommend offline methods when WooPayments is supported
* On suggestion enablement redirect to the same task page
* Lint fixes
* test: Fix unit tests
* Maintain deprecated navigation logic
* Prep for cherry pick 51541
---------
Co-authored-by: Vlad Olaru <vlad.olaru@automattic.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.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>
* Add search results count to the in-app marketplace (#51266)
* Add searchResults to context
* Use setSearchResults in Content
* Add ribbons to the tabs
* Changelog
* Use setState as the function name
* Only show ribbon counts when there's an active search
* Refactor how 'setSearchResultsCount' is used (h/t @mcliwanow)
* Don't populate initial search results
* Unify css styling
* Marketplace: bring back the loading state (#51342)
* Marketplace: bring back the loading state
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Remove in-app marketplace Search results tab and unify results into existing tabs (#51297)
* Remove search results component and any references to it
* Persist current tab for searching, or default to extensions if tab is not set
* Persist term when switching across tabs
* Lint
* When a search is initiated, fetch all categories to keep the tab counts up to date.
The necessary filtering to display data to the current screen will be performed on the frontend.
* Apply correct colors to the tabs, as per design
* Beyond query.term, also rely on isLoading so that search result counts don't jump
* Address an issue when the user searches for something that returns no results in the business services tab
* Changelog
* Addressed :)
* Change key to category
* Fix category filter being broken
Whenever a category is requested, we need to do an additional request with the category param being the current category (overriding extensions/theme/business services).
Ideally the backend API would make a distinction between type (theme/extension/business service) and category, but this hack should do for now.
* Lint
* Remove unused variables h/t @KokkieH
* Lint
* Revert "Lint"
This reverts commit 0b2d2dca6d.
* Actually fix lint without introducing infinite loop
Reproducible at http://localhost:8080/wp-admin/admin.php?page=wc-admin&term=payments&tab=extensions&path=%2Fextensions&category=customer-service
* Show category selector even if there are no results displayed
* Update comment to be less misleading
* Query isn't used here
* Update Marketplace search component (#51313)
* Update Search placeholder text
* Replace search component with one from @wordpress/components
* Make mobile search field font consistent with desktop
* Add changefile(s) from automation for the following project(s): woocommerce
* Handle import errors for SearchControl component
---------
Co-authored-by: github-actions <github-actions@github.com>
* Marketplace: update category selector (#51309)
* Marketplace: update category selector
Remove the dropdown on the desktop view and show all items, even if
overflowing. Added helper buttons to scroll to the right to show more.
* Add changefile(s) from automation for the following project(s): woocommerce
* Marketplace: remove category sroll helpers from tabindex
GitHub:
https://github.com/woocommerce/woocommerce/pull/51309/files#r1758448638
* Marketplace: Remove selectedTab reference from product.tsx
This is probably included due to the merge conflict
* Marketplace: tweak category scroll button narrower
---------
Co-authored-by: github-actions <github-actions@github.com>
* Lint
* Fix 2 lint errors
* Fix another lint error (useMemo) h/t @KokkieH
* Add load more button in-app (#51434)
* Add additional fields returned by search API to marketplace types
Ensure components have access to additional fields
* Add LoadMoreButton component
* Only render Load More button if there are additional pages of results
* Fetch and display next page of results in Load More button is clicked
* Simplify renderContent function to have less repetition
- Hide load more button while fetching results
* Improve loading of new products
- Ensure keyboard focus goes to first new product after Load More is clicked
* Add changefile(s) from automation for the following project(s): woocommerce
* Add blank line to separate sections
* Set category param based on current tab when loading more products
* Improve busy-state screen reader text
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
* Add missing dependency
* Move getProductType() function to functions.tsx
- Do not show load more button if isLoading state is true
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
* Rework the values used with `setSearchResultsCount`
After https://github.com/Automattic/woocommerce.com/pull/21678/files we
get a `totalProducts` so we can re-use that.
Also remove setting the counts when paginating since we set them to the
total.
* Add search complete announcement h/t @KokkieH
* Show update count only if greater than 0 h/t @andfinally
* Switch to Extensions tab if on My subscriptions when searching
* yoda
---------
Co-authored-by: Cem Ünalan <raicem@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Herman <KokkieH@users.noreply.github.com>
* Skip "Restricted coupon management" - error 500
* Make `wooPatterns` element more specific
* Skip "Merchant can view a list of all customers" - more customers due to using existing website
* No LYS on WPCOM
* Dismiss notice if shown
* Expand WPCOM suite
* Click on `Canada`
* Click on `Canada`
* Be more specific about `Delete` button
* Add changefile(s) from automation for the following project(s): woocommerce
* Skip two more tests - WC patterns and block
* Remove usage of `networkidle`
* Handle notice if present with `addLocatorHandler`
* Fix ESLint issue
---------
Co-authored-by: github-actions <github-actions@github.com>
Modify API response tests to assert that expected key values are present.
This differs from earlier assertion which checks for exact equality. However the earlier assertion was brittle and would fail when a new property is added, for example in https://core.trac.wordpress.org/ticket/61739.
With this change, any addition to schema will not breaking existing API tests.
* Refactor remote logging in WooCommerce
This commit refactors the remote logging functionality in WooCommerce to improve its efficiency and flexibility.
- In the `class-woocommerce.php` file, the `context` array now includes a new key `remote-logging` to indicate whether the error should be logged remotely if remote logging is enabled.
- In the `RemoteLogger.php` file, the `file` key in the `context['error']` array is now assigned to the `$log_data` array, and then unset from the `context['error']` array.
- The `should_handle` method in the `RemoteLogger` class now checks for the presence of the `remote-logging` key in the `context` array. If it is not set or set to `false`, the log is ignored.
- The `RemoteLoggerTest.php` file includes new test cases to ensure that the `should_handle` method returns `false` when the `remote-logging` key is not present in the `context` array.
These changes improve the remote logging functionality in WooCommerce and make it more robust and efficient.
* Revert log format change
* Set remote-logging context to true in log remote event method
* Add changelog
* revert change
* revert change
* Updated Product attributes placeholder to e.g. length or weight
* Added Changelog
* Add changefile(s) from automation for the following project(s): woocommerce
* Delete changelog/51134-product-attribute-placeholder-update
* Add changefile(s) from automation for the following project(s): woocommerce
* Revise changelog.
* Add changefile(s) from automation for the following project(s): woocommerce
* Satisfy linter.
* Increase exactitude to reduce ambiguity levels.
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Add locale from php
* Add changefile(s) from automation for the following project(s): woocommerce
* Return a full locale with language and region code
* Fix style
* Fix error
* Lint fixes
* Lint fixes
---------
Co-authored-by: github-actions <github-actions@github.com>
* Fixed call to member function is_visible Fatal Error
* Implemented the suggestions
* Add changefile(s) from automation for the following project(s): woocommerce
* Updated the @version tag
* Promote 'comment' to actual changelog entry.
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Move WooCommerce Brands into core
* Fix linting errors in brand-thumbnails.php
* More lint fixes for brand-thumbnails.php
* Fix lint issues in brand-description.php
* Fix lint errors for brand-thumbnails-description
* Lint errors: Fix taxonomy-product_brand
* Lint errors: fix taxonomy-product_brand
* Linting: Try adding a space between ignore command and docblock
* Another try to remove the lowercase file name error
* Another try removing lint error for lowercase files
* Lint errors: Fix brands-a-z.php
* More lint fixes for brands-a-z.php
* More lint fixes for brands-a-z.php
* Lint fixes: brand-description.php
* Another try fixing lint errors for brand-description.php
* Another try fixing lint errors for brand-description.php
* More fixes for brand-description.php
* Fix lint errors for Packages.php
* More fixes for Packages.php
* Linting fixes for Brands.php
* Added docblocks for WC_Widget_Brand_Thumbnails variables
* Add script to fix coding standards for files changed in branch
* Run autofix script for linting
* Lint fixes for class-wc-widget-brand-thumbnails.php
* More lint fixes for: class-wc-widget-brand-thumbnails.php
* More lint fixes for class-wc-widget-brand-thumbnails.php
* Lint fixes for class-wc-widget-brand-nav.php
* lint fixes: ignore docblocks
* Another try to fix missing docblocks
* Another try to fix missing docblocks
* Another try fixing missing docblocks
* Better messages for fix-branch.sh
* Fix lint errors in class-wc-widget-brand-description.php
* Fix linting errors in REST API and functions classes
* Fix linting issues in class-wc-brands.php
* More lint fixes for wc-brands.php
* More lint fixes for wc-brands.php
* Fix lint errors for wc-brands-coupons.php
* Fix lint errors for class-wc-brands-block-templates.php
* Fix linting errors for class-wc-brands-block-template-utils-duplicated.php
* Fix lint errors in class-wc-admin-brands.php
* More fixes in class-wc-admin-brands.php
* More class-wc-admin-brands.php
* More lint fixes for: class-wc-admin-brands.php
* More lint fixes for class-wc-admin-brands.php
* Transfer unit test
* Transfer e2e test
* Added specific versions to templates
* Added changelog
* Another try for HTML templates version
* Fix lint errors in test files
* More lint fixes
* Fix lint warnings
* Added brands to list of expected REST API fields
* More lint warning fixes
* More lint warning fixes
* Updated unit tests to include brands
* Remove whitespace
* Added declare( strict_types = 1); to all PHP files
* Added declare( strict_types = 1) to test file as well
* Fix: There must be exactly one blank line after the file comment
* Temporarily remove Brands e2e tests
* Move Brands blockified templates
* Remove script to fix lint errors in current branch
* Try removing pull-package-deps
* Bring back deps
* Commit pnpm-lock.yaml
* Add debug statements
* More debug statements
* Make regular expression more specific
* Make matches more specific
* Search only for PHP templates
* Bring back whitespace
* Remove unnecessary change
* Update pnpm-lock.yaml
* Change the way Brands files are included
* Include all files
* Prevent Brands assets from being double-enqueued
* Move Brands scripts handling into core
* Revert changes in the template-changes.ts script
* Use strict in_array
* Add scaffolding for Brands test
* Add more scaffolding for Brands tests
* Enhance e2e test by adding steps for creating a Brand
* Move Brands test to Playwright folder
* Added manifest
* Fix lint errors in tests
* Move Brands coupons test into core's coupons tests
* Fix linting error in tests
* Move all Brands initialization within the /Internal/Brands class
* Rename `$merged_packages` to `$merged_plugins`
* Add force disable method back
* Move Brands logic outside core files
* Rename admin styles
* Remove brands logic from core's admin class
* Roll back all changes in admin assets class
* Fix linting errors
* Move REST API logic to Brands main class
* Introduce an option to control whether the Brands package is enabled.
Prevent autoloader from loading classes already loaded by individual Packages.
Fix an issue with Brands admin styles.
* Bring back pnpm-lock
* Add comment
* Split long line into two
* Review default values for remote variant assignment
* Rename global functions and add polyfills for deprecated functions
* Bump versions
* Fix some lint errors
* More lint fixes
* Set woocommerce_remote_variant_assignment for Brands to be enabled for unit tests
* Replace reserved word class with class_name
* Another try to include Brands files in tests
* Remove Brands from REST API tests
* Skip Brands tests while Brands is behind a feature flag
* Lint fixes
* Remove empty line
* Added feature flag.
* Fix widgets form
* Fix lint errors for brand description widget
* Fix lint errors for brand description widget
* Fix lint errors
* Bump version
* Updated tooltips for Brands coupon restrictions to match core's
* Fix lint errors
* More lint fixes
* Add REST API v3 for Brands
---------
Co-authored-by: Walther Lalk <83255+dakota@users.noreply.github.com>