* Support searches as a direct feature of (COT) order queries.
* Always add `DISTINCT` to order queries.
* Add test (+fix order search logic for matching order IDs).
* Changelog.
* Clean-up search_orders() method, remove original roughed-out search code borrowed from CPT data-store.
* Tidy.
Handle invalid `meta_query` similarly to `WP_Query`
`meta_query` needs to be an array of arrays. Elements in `meta_query` that do not conform to the expected format will be ignored.
* Expose the SQL query in OrdersTableQuery for debugging purposes (similar to WP_Query)
* Add changelog
* Drop unnecessary `is_array()` check
* Add additional class to no-products-found banner.
By adding an additional class of `woocommerce-no-products-found`, we can
target the info banner contextually without running the risk of
impacting notifictaions in other areas of the active theme.
See https://github.com/woocommerce/storefront/pull/2027#issuecomment-1218083764
* Add changelog for update.
* Add initial product field and modal for editing product link
* Create a product link modal for editing product link
* Only show permalink when product is published
* Add changelogs
* Add changelog for data package
* Change save button to primary
* Fix merge conflcts
* Add getPermalinkParts selector to products store
* Made use of getPermalinkParts to support draft products
* Link backfilling to migration process.
* Add changelog.
* Reduce batch size for backfilling since it is slower.
* Correct grammer.
* Link backfilling with data synchronizer and adopt with pending migration on both sides.
We already have backfilling implemented, however it was not linked. This would make switching data stores back to posts table not possible. This commit links datasynchronizer so that it can both migrate as well as backfill.
* Remove _recorded_sales from skipped check keys since its implemented.
* Share concrete instance of cot controller to share feature value.
* Revert adding concrete controller, object instance is already shared.
* remove yoda condition.
* Remove unintended change.
* Revert from using gmdate.
* Remove hardcoding.
* Remove doc block for fake option support.
* Comment out option check for better testability.
* Add initial SearchControl component
* Add async example
* Reorganize getItemPropsType type
* Create separate MenuItem component
* Update items to use value/label pairs
* Add fuzzy matching example
* Use MenuItem component in example
* Add callback method example and onSelect prop
* Add custom render example
* Add styling
* Simplify Menu component
* Add changelog entry
* Update SelectControl to DeprecatedSelectControl
* Rename SearchControl to SelectControl
* Add readme
* Add placeholder prop
* Add icon to combox box
* Rename deprecated SelectControl classes
* Add changelog entries
* Pass menu props to menu to fix ref issues
* Update lock file
* Rebase and update lock file
* Fix up IDs in e2e tests
* Make list structure more semantic
* Fix update conflict with pnpm-lock
* Move new SelectControl to experimental
* Change experimental class name to avoid style conflicts
* Fix up latest lock file from rebase
* Remove onboarding e2e changes
* Update changelogs
* Update lock file again
* Update pnpm-lock and fix lint error
Co-authored-by: Lourens Schep <lourensschep@gmail.com>
* Added new command to set up the local environment with COT enabled.
* Removed new file added to e2e-environment, which we will no longer be using.
Co-authored-by: jamelreid <jnoelreid@gmail.com>
* Add a filter woocommerce_get_note to modify note before it is returned
* Make ChoosingTheme.get_note public so we can call it outside
* Implement the get_note filter to return localized strings
* Create get_actions method to reuse it in RemoteInboxNotificationsEngine
* Implement get_note filter in RemoteInboxNotificationsEngine to return localized note
* Add changelog
* Make GivingFeedbackNotes.get_note public so we can call it outside
* Check if note class has NOTE_NAME constant
* Update WooSubscriptionsNotes to show localized content
* Rename filter hook name
* Remove todo to pass php lint
* Update filter description
* Move locale check into individual filter functions
* Fix get_note_from_db logic
* Fix php lint errors
* Update the filter doc
* Add test for spec-runner.php
* Add tests for RemoteInboxNotificationsEngine
* Remove unneeded check
* Check if $note_from_class is instance of Note class
* Fix unit test
* fix: tax calculation and coupon sequence
* add phpunit skeleton
* Refactor calc_line_taxes and add_coupon_discount
The methods are moved to separate classes in src/Internal,
and two new "core" methods that exclude HTTP processing are added.
* The test partially passes now
* Final fix to unit tests, and fix remaining formatting issues
* Add changelog file
* Fix path to html-order-items.php
Co-authored-by: Siddharth Thevaril <siddharth.thevaril@gmail.com>
* Show WCPay welcome page to all eligible merchants.
Remove the experiment and also check for marketplace suggestions.
* Update banner design and copy
Replace background `wcpay-banner.png` with `wcpay-offer.svg`, `flag.j` svg component with `gift.js`. Adjust styles and ensure it's responsive.
* Add more requirements.
Don't register it when there is an existing WCPay account or the site is on a WPCOM starter plan.
* Update promotion and FAQ copy
* Add the new experiment.
And remove the supported country check to use Explat instead.
* Add changelog entry
* Remove WPCOM starter plan check
* Remove Yoda comparisons
* Update `wcpay_exit_survey` event.
Record it also when the user chooses `Just remove` and use snake_case to avoid Track errors.
* Country and time conditions.
Only for US based businesses with a live store of at least 90 days.
* Update design and copy to match new requirements
* Update promo ID
* Fix country condition
* Load SVG as image instead of background
To prevent wrong asset generation due to Webpack configuration
* Fix WCPay installed condition
* Update promo ID
* Update promo ID in allowed notes
* Update FAQ copy
* Add `apply_filters` docblock
* Add missing `@since` to docblock comment
* Do not create default shipping zones when a shipping zone already exists
* Add changelog
* Use woocommerce_admin_skipped_creating_default_shipping_zones to avoid triggering spotlight tour
* Set woocommerce_admin_reviewed_default_shipping_zones to yes to prevent spotlight tour for the existing shipping zones
* Remove WCPay Subscriptions offer page experiment
This removes all code added in PR#32957 as experiment has ended.
(WooCommerce > Subscriptions admin menu item and empty state offer screen)
* Add changelog entry
* Make the php file valid
* Remove code that's no longer in PHP.
mysql_* functions were removed in PHP 7.0
* Remove deprecated setting.
This only helps detecting \r as end of line and that should only be used in old MacOS 9 which is 20 years old by now.
* Changelog
* Added compulsory file comment.
* Removed forgotten phpcs flag
* ...and more cleanup.
* Implement filtering by status in list table
* Respect ‘show_in_admin_status_list’ in list table
* Display correct status name for ‘draft’ and ‘trash’ post statuses
* Renamed e2e to e2e-legacy
* Moved e2e folder to tests/e2e
* Updated gitignore
* Updted init script to work with wp-env
* Updated readme
* Updated commands to match new test structure
* Updated workflow to work with new test structure
* Added changelog
* turned off alternate wp cron in test
* Fixed path to playwright config
* Renamed e2e to e2e-pw
* Renamed e2e-legacy to e2e
* Updated e2e-pw path
* Fixed workflow
* Fixed csv test
* Updated .gitignore
* Removed puppeteer specific step
* dev: moved shipping tour into guided tours folder
* dev: moved store address tour to guided-tour folder
* dev: updated imports for store address tour code move
* dev: move add-product-tour to guided-tours
* dev: update imports for add-product-tour code move
* Column sorting for the COT admin list table.
* Add filter for easier extensibility.
* Implement date based filtering within the admin order list table.
* Implement customer-based filtering within admin order list table.
* Allow filtering down to no results, better management of http_referer state.
* Changelog.
* Bring up-to-date, fix some conflict resolution mis-steps.
* Address coding standards.
* Remove unused import.
* Add initial product form action buttons to form
* Add new edit page and allow for updating and creating products
* Move crud functions to helper hook to keep things seperated better
* Add changelog
* ADd package changelogs
* Add isPending selector to products store
* Fix trash screen showing up when deleting product and add loading indicators
* Add extra types to Product type
* Update track names and add product data to tracks
* Update track logic when product is published
* Remove the Image section for now, to prevent confusion as it is not ready yet
* Add tests for the product form actions
* Update copy for publish & duplicate
* Remove unused code
* Set window.location correctly with href
* Reset changes in pnpm lock
* Moved pending action variables to product helper and updated buttons to reflect new suggestions
* Fix backwards compabitibility issue with Form changes
* Add switch to draft button
* Use WC_Order_Query for REST API v3 requests when COT is enabled
* Remove pre-COT internal meta keys from metadata in REST order responses
* Add changelog
* Add unit tests
* Fix test in `ProductAttributesLookup\FiltererTest`
Some tests in this class relied on a particular ordering of an array of IDs returned by a query with an `ORDER BY` that doesn’t really disambiguate sorting (all rows have the same values for the fields). As such, `assertEquals()` can’t be used to make sure arrays had the same values.
* Use `get_internal_meta_keys()` from a CPT instance to hide certain meta on COT REST response
* Move COT REST test outside of the COT datastore tests
* Fix typo
* Remove unnecessary imports
* Make ProfileItems properties optional
* Remove skip button codes and replace them with SkipButton component
* Add SkipButton component
* Add changelog
* Add back continue button callback
* Apply popover styles globally
* Add skip button on the industry step
* Add skip button on the product types step
* Add skip button on the Business Details step
* Support onSkipped callback
* Record skip event
* Add skip event track for industry, product types, and business details
* Add SkipButton to the theme step
* Update snapshot
* Change track name to separate business details and free features
* Add changelog
* Remove unused code
* Update product types test snapshot
* Add back UsageModal on Continue click
* Update e2e tests to use Skip
* Use button selector for skip btn
* Fix duplicate event dispatch
* Do not call onClose and onContinue during the rendering -- it causes cannot update a component while rendering a different warning. Instead, call them when the button is clicked
* Skip the profiler without rendering usage modal when woocommerce_allow_tracking is set
* Skip the profiler without rendering usage modal when woocommerce_allow_tracking is set
* Go to the next step when allowTracking is yes
Add screen reader labels to improve accessibility in various locations.
* Adding missing table header labels
* Adding missing form field labels
* Adding missing form field label
* Adding missing form field labels — Ideally we would add these with `<labe>` tag (may be hidden with `screen-reader-text` class), but playing safe here to prevent CSS style issues.
* Adding missing form field label
* Changing `aria-label` attribute to actual `<label>` tag
* Rebase; add changelog.
Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
Add method in utils to check whether posts and order tables are in sync.
* Add changelog.
* Fix Yoda condition
Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
* Add e2e test to check ability to add and remove regions from shipping zone
* Add changelog file
* skip test in order to check CI
* add skipped test back in
* group shipping zone tests to avoid concurrency issues
* update assertions relevant to added zone region
* update test file
* update test to select appropriate delete based on other tests
* Ensure the correct Shipping Zone has been removed
* remove attempt to delte zone via front end as API call will handle this
* Update store details task complete logic
Mark as completed if the store address, city and postcode are set.
* Add changelog
* Update store details test
* Stop resetting all definations in DI to not initialize hooks again.
* Adjust setting test to account for COT feature.
* Support temporary tables.
* Add changelog
Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
- Use the built-in phpcs sniff for "includes" (as warnings)
- Use the slevomat coding standards package for the rest of the code
(as errors, with the ability to auto-correct)
* Change package json commands and turbo repo config to allow for greatly simplifying running turbo
* Remove require-turbo script which was causing caching issues
* Colorize CI output from scripts
* Add missing changelog script to extend-cart-checkout-block
* Add product page layout components
* Add a quick sample page to test the product form layout
* Add changelog
* Add option 2
* Refactor the product field layout structure
* Update page component structure of product form
* Add simple SlotFill support
* Update product page chunk name
* Add order to slot fill and move product field layout wrapper into product category layout
* Remove unused import
* Consolidate the slot fill ordering logic
* Rename category component to section component to prevent confusion
* Remove edit product page and use the new add product page instead
* Add tests
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Update store details unit tests
* Update store details subheading and field order
* Update obw store details e2e tests
* Add changelog
* Add changelog
* Update Store owner can go through setup Task List test
* Add feature falg
* Modify href to menu item
* Modify page title href button
* Add product files on Client
* Change button's URL for new Nav
* Add changelog
* Moved changelog
* Fix URL for new nav
* Change URL for add product task
* Add Tracks event
* Change const name
* Renamed tracks event name
* Undo Add New Product redirect
* Undo use Products addition
* Undo lint fix to woocommerce_admin.js
* Rename component and file (AddProductPage)
* Set flag in core.json to false
* Fix typo
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Update miscellanous WC bits to support custom tables.
* Add changelog.
* Add test for order_meta call.
* Make CI happy.
* Add tests for before_delete_order.
* Add test for is_valid_resource
* Add tests for PayPal API.
* Add test for save paypal meta data.
* Minor fixup.
Remove the explicit dependency from the psr/container package
* Prepend the psr/container package classes with a namespace using Mozart. This is done to prevent conflicts with other versions of the package used by other packages or plugins.
* Add changelog file
* Minor documentation/indentation updates
* Column sorting for the COT admin list table.
* Add filter for easier extensibility.
* Changelog.
* Add support for orderby order’s total and creation/modification dates
* Remove unnecessary import
* Use ‘any’ instead of ‘all’ as status so that all valid statuses are used instead
* Use ‘order_total’ as orderby GET arg for backwards compat
* Rework sorting logic after support in `OrdersTableQuery`
* Update `@since` tag
* Make PHPCS happy
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
* Remove setup_experiment_1 and setup_experiment_2 tests and css
* Remove setup_experiment_1 and 2 from the client code
* Copy over setup_experiment_1 options to the setup tasklist and remove setup_experiment_1 and 2
* Add changelog
* Determine the default component to use by task id
* Update plugins/woocommerce-admin/client/tasks/hooks/useActiveSetupList.ts
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Introduce the ObjectCache class.
It's an abstract class intended to be used to implement caching for
any kind of object (arrays or PHP objects) using the underlying
WordPress caching or any alternative custom cache engine.
* Add changelog file
* Change the order of parameters in ObjectCache::get
Also change the max expiration value from one day to one month
* Implement order edit screen rendering.
* Add changelog.
* Use global function instead of harcoded string.
* Use pagecontroller to display order edit form.
* Move HTML out from the translatable string.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Capitalize `Order` for consistency.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Minor realignment.
* phpcs fix .
* Decouple meta boxes from global $post object to support custom order tables.
* Bug fixes - improperly set $order object, and allow passing null.
* Make order item meta work with order object.
* Use `$order` object to minimize diff.
* Refactor $theorder object initialization to a common method.
* Remove check for WC_Order object.
* Move common methods to inside `src` in a dedicated class.
* Fix spacing for code style.
* Renamed method to be more accurate.
* Add proxies for static so they can be mocked.
* Remove PageController import.
* Move helper methods to an internal util class.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Support force_default_suggestions argument
* Use force_default_suggestions
* Support force_default_suggestions argument -- returns the default payment suggestions when both woocommerce_show_marketplace_suggestions and woocommerce_setting_payments_recommendations_hidden options are set to no
* Add changelog
* Add methods to get and clear queued pixel events
* Add utils for getting and asserting events in unit tests
* Add in some assertions around task list completion tracks
* Add changelog entry
* Add comment for test task fixture
* Stop re-enabling product attributes lookup table usage after each install.
Now the option will be enabled after a WooCommerce install/update
only if the user hadn't explicitly disabled it before.
* Add changelog file
* Make sure orders are saved with a default status
* Add support for ‘customer’ query var in COT
* Make PHPCS happy in COT datastore tests
* Add tests for ‘customer’ query var
* Add changelog
* Add OrdersTableQuery for querying the COT tables
* First stab at `OrdersTableDataStore::query()` method
* Silence possible PHP warning
* Add docblocks & phpcs fixes
* Introduce OrdersTableMetaQuery
* Add support for meta_query
* Add changelog
* ‘status’ should have the ‘wc-‘ prefix
* PHPCS fixes
* Minor improvements
* Add tests for OrdersTableQuery
* Remove ‘paginate’ query var
* Add support for reading multiple objects at once
* Address feedback
* Prevent `get_order_data_for_ids()` from producing an incorrect query when no IDs are passed
* Make CI happy
* Add WooCommerce default styles for block themes
* Ensure sale badge remains as is in Twenty Twenty-Two
* Style the mark element in theme colors
* Update product variations dropdowns
* address feedback
* address feedback
* fix store notice position
Co-authored-by: Luigi <gigitux@gmail.com>
The attributes page displays all the terms for all the existing
product attributes, which causes a performance problem in sites
with a lot of attributes and terms.
This commit limits the number of attributes shown to 100 by default,
but it also introduces a woocommerce_max_terms_displayed_in_attributes_page
filter to customize it.
* Use method_exists instead of throwing in reflect_class_or_callable
In AbstractServiceProvider::reflect_class_or_callable we were
detecting whether a 'init' method exists in the class or not via
doing 'new ReflectionMethod' and catching the exception.
This caused problems with XDebug, which is bad enough, but additionally,
throwing an exception when it's not abosultely necessary
is a bad practice in general.
* Add changelog file
* Fix code standards errors in class-wc-meta-box-orrder-data.php
- Sanitize all input
- Escape all output
- Verify nonce on save
- Verify that all required POST parameters are present on save
- Minor fixes (periods at end of comments, function docs, Yodas...)
* Check payment method name, not title, on add_order_item_totals_payment_method_row
* Remove unnecessary nonce verification in "save" for orders.
Also move comment to new line for readability.
* Remove unnecessary nonce check in WC_Meta_Box_Order_Data::save
The check is already performed in the code that invokes "save".
* Add transaction id to payment method string if URL doesn't exist
* Minor fix
Co-authored-by: Jorge A. Torres <jorge.torres@automattic.com>
* Update woocommerce admin scripts to align more with monorepo
* Add changelog
* Add dev script back in
* Add install-if-deps-outdated back into build script
* Remove --force from dev script and add WC_ADMIN_PHASE to turbo cache key
* Remove install-if-deps-outdated from build
* Add composer install step to pr unit tests workflow
* Remove old install scripts, that are not needed anymore
* Make sure client changes are part of the cache hit
* Add composer install to code coverage and code sniff as well
* Add composer_no_dev input to install-build workflow
* Add sass dependency to woocommerce/admin/client turbo cache
* Add validations to `recordEvent`
* Add changelog
* Use always class constant
* Changed trow exception by console.error
* Add tests to `validate_and_sanitize`
* Created 2 different methods to test `event_validation_and_sanitization`
* Fix tests
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Fix free features is still rendered when there is no recommendation
* Add changelog
* Update BusinessDetails tab to go to next step if no installable extensions
* Update spinner
* Set retries to 4 on CI
* Use variable for authentication path storage
* Handle test cleanup in after hook
* Improve conditional
* Clean up global attributes
* Update customer email address
* Changelog file
Co-authored-by: Jon Lane <jon.lane@automattic.com>
* Updated wp-env test port
* Added script to init test env
* Added env helper scripts
* Updated admin email to match wp-env
* Fixed flaky tests
* Updated test readme
* Updated workflow to use wp-env
* Added changelog
* Stored admin email in variable
* Added check for flaky test
* Updated workflow to work with both envs
* Updated README.md
* Updated condition
* Updated changelog
* Fixed workflow
* Fixed workflow
* Fixed workflow
* Restored workflow
* Updated check to be a string
* API: System Status: Cache plugins data
This is a follow up to https://github.com/woocommerce/woocommerce/pull/32823
where we introduced caching for retrieving theme data. Here we're
cachcing plugin data. Since we have to read from the filesystem and
parse the plugin headers, this can be kind of slow.
We should see an improvement on sites with more than a few plugins and
the improvement could be significant on sites that have many plugins
installed (even if they're not active).
* add CLI com command class and hook it
* Update php docs and change registered command names for wc com.
* Fix lint issues.
* Retrieve and display extension list and for the connected site.
* Adding the changelog for wc com extension list
* Remove the install command which not implemented in current branch.
* Update example usages for wp wc com extension list command.
* Update changelog.
* Fix the changelog file formatting
Co-authored-by: Rommel Castro <rommelxcastro@gmail.com>
Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
* Update github action to equire valid changelog file
* Update github action for changelogger to install depedencies and composer
* Make valid changelog files that were invalid
* `add_meta()` should be more flexible
* Add `delete_order_data_from_custom_order_tables()`
* Add private method `trash_order()` to COT datastore for handling order trashing
* First stab at COT datastore `delete()`
* Delete COT data for orders when deleting its associated post
* Add changelog
* Simplify delete logic
* Minor fixes
* Rework `create()` tests
* Add tests for `delete()`
* Remove unnecessary var
* Set allowedTextDomain to only allow woocommmerce text domain
* Set allowedTextDomain to only allow woocommerce text domain
* Fix wrong or missing i18n text domain
* Add changelog
* Add changelog
* Updates to simple product test to reduce flakiness
* Remove focus
* Fix to improve flakiness of order refund test
* Added a wait to help page loads test
* Add a couple more waits to refund tests
* Changelog
* Retry key generation during global setup
* Setup checklist has changed, update
* Update to setup task list
* Add wait for setup checklist
* Update locator for install checklist
* Changelogger: Fix PHPCS violations (#33664)
* Deploy header task variant from task list experiment (#33750)
* Deploy task list experiment 1
* Add changelog
* Fix wrong copy in the payment task (#33749)
* Add headingDescription prop to PaymentGatewaySuggestions list
* Fix payment suggestions heading text
* Add changelog
* Fix missing manage button for TikTok (#33731)
* Fix missing manage button for TikTok
* Add changelog
* Packages: Fix postinstall errors on install (#33724)
* Fix additional payment task name (#33727)
* Rename "Set up additional payment providers" task -> "Set up additional payment options"
* Add changelog
* Remove change files for #33704 (#33734)
* Add shipping class data store (#33765)
* Add initial shipping classes data store
* Add types for the product shipping class store
* Filter out undefined items in list for when an item is deleted
* Add changelog
* Add data store README
* Fix onboarding test
* Skipping flaky test
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: jonathansadowski <jonathansadowski@users.noreply.github.com>
Co-authored-by: louwie17 <lourensschep@gmail.com>
* Final updates for Playwright
* Update config
* Add uuid dependency
* Increase retries to 2
* Update selectors on shipping page
* Use baseURL instead of hard-coded URL for API
* Clarify comment
* Use baseURL instead of hard-coded URL
* Check to see if an order was created before attempting to delete it
* Add changelog
* Turn on Playwright tests in GitHub
* Increase timeout for CI execution
* Update configuration options (minor edit)
* Fix for checkout flaky test
* Parse orderId from URL
* Check for substring
* Streamline email tests
* Remove .only
* Only clear email logs of messages for test
* Get orderId from page element
* Fix for test not waiting for reset
* Add in second wait for Performance section
* Change significance from minor to patch
Co-authored-by: Jon Lane <jon.lane@automattic.com>
* Make sure the default form value tooltip is initialiazed when adding the first variation
* Update copy of default form value tooltip in variations
* Add changelog
* Fix auto formatting
* Add pointer events: none to tooltip to prevent flickering
* Change review shipping task id to 'review-shipping'
* Add click track for shipping-recommendation task from the settings page
* Changelog
* Add test
* Add more specific test param
* Add pyament icons
* Add changelog
* Text and logo changes when wc pay is installed and setup
* Use PaymentSuggestions to query plugins
* Make sure image_72x72 exists
* Remove unused namespaces
* Remove stripe2 image -- no longer needed
* Make sure recommended payment is not already active
* Check plugins field to filter out active plugins
add: intro tooltips for shipping smart defaults
- removed php code for setting 'reviewed' option as it was being set on page load and thus always evaluated to true before the user sees it
- added intro tooltips
Update wp-background-process.php to use wp_convert_hr_to_bytes()
Currently the code is typecasting the memory limit to an int. This assumes that the memory limit is in MB, so if you set your memory limit to 4G this will return 4194304 bytes (4.19304 MB.) Instead, we should use the native WordPress function `wp_convert_hr_to_bytes` to handle the conversion into bytes correctly.
* Update StoreDetails task action url to navigate to the setting page
* Add changelog
* Update complete logic of StoreDetails task
* Update store details unit tests for new task completion logic
Added `triggerHandler` before each ajax request.
* Added namespace to event name
* Linting.
Co-authored-by: Luigi Pulcini <luigi@barn2.com>
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
This reverts commit bccc80366d.
When we merged this PR, we thought the Woo mobile apps would have enough time to implement some corresponding changes on their side. That turned out not to be the case. Without the ability to force a refresh of the analytics cache, this PR causes the apps to have a greater risk of showing users stale analytics data that they can’t immediately update.
* Include Tracks property indicating block editor on product update.
* Add changelog
* In a block editor the Update button does not have the selector.
* Remove - from Tracks even property.
* Refine a condition of a non-empty object.
* Incorporate feedback: add callback for rendering the Update button.
* Add recent feedback- jQuery way of handling post render execution.
* Remove `console.log
* Fix `product_update` event recording
* Removed `hasRecordedEvent` and fixed `description validation
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Update shipping task fields when shipping smart default feature is enabled.
* Always display the shipping task regardless of having a physical product
* Updated text copy for the fields
* Do not display the step description if it is not the current step
* Added a banner for the shipping printing step
Remove description if the it is not the current step
* Add changelog
* Fix namespace conflict after the rebase
* Re-use wcs banner from the experimental shipping recommendation
* Delete ShippingLabelPrinting -- replaced by wcs banner from experimental-shipping-recommendation
* Add TOS link
* Remove ShippingPrintLabel styles -- no longer needed
* Minor refactor
* Move description set logic to getSteps()
* Use map to override step fields
* Remove unnecessary feature check
* Remove description in the map func
* Render ShipStation banner if plugins includes woocommerce-shipstation-integration
* Plugins component skip button is now optional
* Add link from payment settings page
* Add new experimental shipping task flow
* Changelog
* Update plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/ExperimentalShippingRecommendation.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Rename all tracks to shipping_recommendation
* Add back skip installer bind
* Pass plugins list to pluginSlugs to be more predictable
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Add logic to set the default shipping options
* Set the flat rate cost to 15 (temp cost)
* Add changelog
* Update plugins/woocommerce/src/Internal/Admin/Homescreen.php
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Run the changes only if shipping-smart-defaults is enabled
* Assume user is going to sell physical products if obw is skipped or the store details has not been completed
* Make sure store country is set by an actual user by checking the value of woocommerce_store_addres
* Remove flat late logic
* Use woocommerce_store_address. store_address is always empty
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
* Add phpcs-changed
* Put report flag value in quotes
* Use phpcs action workflow instead
* Remove no longer used phpcs script
* Remove phpcs ignore rule
* Use proper name for code sniffer step
* Fixes issue #33335
Check for an empty string instead of an empty variable.
* Update wc-product-functions.php
* Update wc-product-functions.php
* Changelog
* Fix cases when $term is false or empty array
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
* Fix broken design of Single Product template in block themes and on sale badge being partially hidden
* Update changelog to mention Twenty Twenty-Two explicitly.
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Fix phpcs errors and warnings
* Fix code that throw deprecation notices in PHP 8.1
The deprecation notices are about:
- Various "passing null to parameter (...) is deprecated"
- Usage of strftime
- Using "false" as if it was an empty array
- Mismatching return type of implemented interfaces,
that's fixed by adding #[\ReturnTypeWillChange]
* Fix some more code that throw deprecation notices in PHP 8.1
* Small commenting/formatting fixes.
* Add changelog file
* Formatting.
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
During migration $wpdb->prepare would force null and empty values to be zero for %f placeholder. This was causing verification logic to fail, which is being addressed in this commit.
The alternative was to insert null values without running them via $wpdb->prepare, but that seemed less safer than converting to zero because it would have to done manually since $wpdb->prepare wouldn't support it.
This commit adds documentation for WooCommerce's client component commands. This should make it easier to know what commands to run to work in these components.
This commit changes it to woocommerce/client/admin. This is an invalid NPM package name and an invalid Composer package name. This will prevent conflicts but also identify it as a component of Core.
In line with the fact that it's a component of WooCommerce rather than a standalone package, `woocommerce-legacy-assets` has been renamed `woocommerce/client/legacy`.
* Trigger the hook that record the track events
once the option settings are updated:navigation and analytics. Tracks do not include yes/no properties, so we record the latter as _disabled.
* Changelog
* Prevent reloading of page immediately after feature updates
* Remove feature specific code in tracks class
Co-authored-by: Joshua Flowers <joshuatf@gmail.com>
* Changes the frequency at which the Reports API cache can be invalidated via the cache version number to be at most once every 10 minutes, instead of with every change to the store.
* Changes the TTL of Reports API cache entries so that they expire after an hour instead of after a week.
The goal of these changes is to increase the chance that a request to the Reports API for store stats will result in a cache hit, thus avoiding expensive, slow queries. The reason for lowering the TTL is so that if multiple store changes are made within the new 10-minute frequency window, the cache data will only be stale for up to an hour. With #33325 users will be able to refresh entries in the cache manually if they think something is stale.
Closes#33315
Make sure payment gateway title is a string before sanitizing.
* Add changelog
* Drop type-hint in `validate_safe_text_field()`
* Update plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Add `OrdersTableDataStoreMeta` to handle metadata for orders
* Add `OrdersTableDataStoreHelper` with various helper functions used in the COT datastore
* Pass some helper classes as args to the COT datastore
* Use `OrdersTableDataStoreMeta` for meta in COT datastore
* Minor fixes to columns definition in COT datastore
* First pass at update() in the COT datastore
* PHPCS fixes
* Remove duplicate `read_meta` calls.
* Register `OrdersTableDataStore` earlier to make container happy
* Do not hardcode table metadata in `OrdersTableDataStoreMeta`
* Correctly format decimals for storing in the db
* read() shouldn’t success on non-existing orders
* Rework persisting to db in OrdersTableDataStore
* Correctly handle some props in OrdersTableDataStore
* Add changelog
* Add missing TODOs
* Remove unused variables
* No need to query db before deleting meta in `OrdersTableDataStoreMeta`
* Simplify OrdersTableDataStoreMeta::update_meta()
* Explicitly enumerate columns in OrdersTableDataStoreMeta::get_metadata_by_id()
* Make COT metadata implementation more generic
* Do not use property_exists() to determine existence of meta value
* Move some methods over to DatabaseUtil and get rid of COT datastore helper
* Rename `CustomDataStoreMeta` to `CustomMetaDataStore`
* Make PHPCS happy
* Add unit test.
* Correct arg passed to persist_order_to_db()
* Remove comment
* Split conditional on multiple lines
Co-authored-by: vedanshujain <vedanshu.jain.2012@gmail.com>
Adds a new collection parameter to all Reports API endpoints that utilize caching, `force_cache_refresh`, which will cause the current request to bypass the cache, re-run the queries for the requested data, and overwrite the previous cache entry with the new results.
Note that this doesn't invalidate the entire cache, only the entry for the particular set of collection parameters and values specified in the request.
This also adds a way to include debugging information related to the cache in the API response. Modeled after the way the Query Monitor plugin adds such information, you can get this by including an `_envelope` parameter in your API request. The debugging info includes whether the cache has been disabled via filter (`should_use_cache`), whether the `force_cache_refresh` parameter was used, whether the returned data was a `cache_hit` or not, and an array of the query parameters that were actually used to create the cache key.
Closes#33221
* Introduce a 'safe_text' field that allows a reduced subset of HTML tags.
* Escape on input as well as output; generalize sanitization function.
* Set reasonable default rules.
* Guard against invalid callbacks (escaping/sanitizing) functions.
* Update plugins/woocommerce/src/Internal/Utilities/HtmlSanitizer.php
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
* Allow alt (accessibility) for img tags; allow class attributes for img and span tags.
* Allow class attr for p tags.
* Use safe_text for payment gateway titles.
* Make HtmlSanitizer available through Utils service provider.
* Update settings code to pull HtmlSanitizer as a service and to use the new sanitize() method.
* Remove `style` from list of allowed attributes.
Allowing arbitrary CSS rules through style could undo the intent of this change, since that would allow a range of positioning and sizing changes to be effected.
* Remove unusued import.
* If no (KSES) rules are specifed, then strip all tags (this is a safer default strategy).
* For better safety, only apply pre-processor callbacks; remove responsibility for trimming of strings.
Applying callbacks to a string after it ahs passed through wp_kses() could (potentially) undo the work done by that function, and result in unexpected tags in the sanitizer's output.
Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
* Update WooStep to have name in meta
* Add useProductStepChange hook and use it to detect form value changes in product tourkit, added tracking for tour view, tour dismiss, tour complete, and step complete
* Add tour view, tour dismiss, tour completion track to old product walkthrough
* Changelog
* Fix test
* Add listener to publish button for product spotlight tour
* Add track for old walkthrough publish button
This replaces all `nx` commands with `turbo` commands and removes Nx from the repository. All of the `project.json` files have been removed and any commands that broke with Turborepo have been adjusted.
This new method is syntactic sugar for array_map. It scans an array
of arrays and/or objects and selects one value from each using
an array key name, an object method, or an object property.
* Add optional usage of database transactions for orders sync.
Includes a new setting in Advanced - Custom data stores to enable
or disable transactions usage and to select the transaction
isolation level.
* Improve the selection of data to be updated when syncing orders.
The SQL query that chooses records to be migrated to core tables
now explicitly excludes unchanged records based on the column mappings.
Also when syncing meta tables with single meta values, records for
which the value hasn't changed are now excluded from the update.
* Fix MetaToCustomTableMigrator to work with order addresses table.
* Add unit tests for db transactions on PostsToOrdersMigrationController
Also add the DynamicDecorator::call_original_method method
* Add product-tour admin script
* Update class-wc-admin-pointers.php to show experimental product tour
* Remove unnecessary window.onload
* Replace add new button with Enable guided mode button for product editing
* Show tour when tutorial query = true
* Add logic to show new tour only when a user select the physical product template
* Update product tour last step button text
* Add auto-scroll effect
* Fix i18n text
* Use bottom-start placement and align the arrow to the left
* Update pnpm-lock.yaml
* Update product tour effects
* Add changelog
* Add doc comments & check for tour-kit
* Add focus elements to product tour and wait initial element for tour showup
* Use spotlight query param to toggle new product tour feature
* Update wait seconds
* Update border style for product description & short description when editor is focused
* Add experimental-product-tour feature flag
* Refactor product-tour and support html editor focus style
Co-authored-by: moon <moon.kyong@automattic.com>
* Fix root namespace indicator in parameter
For LookupDataStore::on_product_created_or_updated_via_rest_api.
This was preventing the v1 REST API endpoint for batch insert of
products from working.
Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
Add individual analytics leaderboard endpoints
Register routes for each of the individual leaderboards.
These leaderboards can be pretty expensive to generate. If you only need
to data from one of them, it can be a pretty significant performance
boost to avoid generating all the leaderboards.
* Add e2e tests to check consistency in shipping costs for cart and checkout pages
Goal of these tests it to check if the cart and checkout pages are
consistent in calculuating shipping costs. Three tests added:
- shipping available to country with states
- shipping available to country without states
- no shipping available (fails, see issue #33205)
Reason to add these tests is PR #25916, which reverted PR #25128,
because the original PR worked for the cart page, but not for the
checkout page.
* Update e2e-core-tests changelog
* Skip failing e2e-core-test
* Fix incorrect URL for the wcAdminAssetUrl and deprecate both wcAdminAssetUrl and WC_ADMIN_IMAGES_FOLDER_URL
* Remove unused wcAdminAssetUrl var
* Remove use of wcAdminAssetUrl
* Add changelog
* Ignore hook PHPCS error -- they are pre-existing
* Add method to get total sales for a timeframe
* Add total payments volume rule processor
* Use start and end dates for total sales method
* Add method to get start and end dates from timeframe
* Update processor rule to use timeframes
* Fix up method calls
* Add tests for timeframes
* Add tests around getting total sales by date
* Add changelog entry
* Use revenue query instead of custom query for total sales
* Update since tag on hook
* Remove orderCount and publishedProductCount setting and make use of data stores
* Add test
* Add changelog
* Make use of orders data store instead of items data store
* Add users param to reports customers API params to allow filtering by user_id
* Fix invalidateResolution call that was misspelled
In order to ease the identification of private packages within the monorepo, this adds an `internal-` prefix to all of the current private packages. This makes it immediately clear when reviewing `packages/js` what is and isn't a private package.
* Add initial tracking for categories, tracks, and attribute product pages
* Update list action tracks that add new items without page refresh
* Add changelog
* Add extra category tracks
* Rename constant for add a new tag button
* Remove unneeded props from track
* Add logs for the attributes and tags on the product page
* Only trigger attributes_add on product screen when user hits save
* Add extra props to attribute add track
* Add tags delete track and fix count of tags add track
* Update use of wp_localize_script
* Fix completed card button
* Update sectioned task list to use onboarding data store
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua Flowers <joshuatf@gmail.com>
* Add infrastructure for mocking globals in unit tests.
- 'get_global' method in LegacyProxy, MockableLegacyProxy and WC().
- 'register_global_mocks' method in MockableLegacyProxy.
- 'register_legacy_proxy_global_mocks' method in WC_Unit_Test_Case.
* Add the DynamicDecorator class, and unit tests for it.
* Add the StringUtil::contains method
* Add unit tests for error logging on PostsToOrdersMigrationController
* Update README file to mention improvements in unit testing infrastructure
- Mention the mechanism to mock globals using the LegacyProxy
- Mention the code hacker and the DynamicDecorator
* Add changelog file
* Set timezone before calling get_weekstartend and after to preserve original timezone
* Add test for timezone check
* Update calculation to be timezone agnostic and add tests
* Changelog
Allow filtering of cookie flags, which enables setting of `samesite`.
* Break out filter so the same filter can be used for any version of PHP.
* Add docblocks and other linting fixes; add changelog.
Props: David Anderson <DavidAnderson684@users.noreply.github.com>
Cleanup twentytwenty notice notices. Closes#29529.
* Increase width of border for notices
* Make notice buttons black to provide sufficient contrast
* Add changelog.
These classes are generic and don't depend on the custom orders table
functionality, so they are moved from src/Database/Migrations/CustomOrderTable
to just src/Database/Migrations.
The class is in the Automattic\WooCommerce\Internal\Utilities namespace,
but it was wrongly placed in the src/Utilities directory. It has been
moved to usr/Internal/Utilities without changing the namespace, thus
no code changes are required.
Using these two order properties instead of the paid_date field is more performance friendly
as both fields are in the wp-posts table - not in the post_meta table.
ref: 71e9657e52 (r875545984)
* Add tracks to products list page
* Remove duplicate tracks
* Add changelog entry
* Check for fields before getting values
* Add bulk actions cancel button
* Check for element before binding event listener
* Check for search input before getting value
In 029257b I inadvertently changed the visibility of the get_objects
method to public. There is no need for its visibility to differ from
the parent class, and it ended up causing fatal errors for other classes
that are extending WC_REST_Products_Controller. This simply changes
the visibility back to protected.
To achieve this:
- A new class is added, TableMigrator, containing basic in-memory
error storage methods, and auxiliary db_query and db_get_result
methods.
- MetaToCustomTableMigrator and MetaToMetaTableMigrator classes
now extend TableMigrator and use these db_* methods.
- process_migration_batch_for_ids is now a method in TableMigrator,
it just calls the abstract process_migration_batch_for_ids_core,
catches exceptions, and returns an array of errors.
- PostsToOrdersMigrationController now logs all the errors returned
by process_migration_batch_for_ids in all the migrator classes.
- New utility method: ArrayUtil::to_ranges_string
There were some inconsistencies, such as trying to treat an error
array as a string, or accessing to a non-existing column from a
dataset retrieved from the db on error.
Many methods were public/protected when they could be protected/private
instead. All methods are adjusted to the minimum visibility required
for the current implementation to work.
Also minor adjustments for phpcs, such as "ignore" comments.
- The woocommerce_custom_orders_table_enabled option can now be manually
altered even if there are orders out of sync
- Saving settings will always restart the sync process, even if one
is already in progress
- Add the woocommerce_orders_cot_and_posts_sync_step_size filter
The cached theme data has some properties that depend on WooCommerce.
This could also extend to extensions. Since we don't have a reliable way
to know if a given plugin is a WooCommerce extension, any plugin update
should flush the cache.
If someone updates their theme outside of the WordPress update process
(by manipulating files directly) the cache won't be invalidated. To deal
with that, we're setting the TTL here to 1hr.
Using _fields, we can specify a sub-property like environment.version.
In that case, we need to extract the top-level property so we known
which function to run.
Generating theme info involves reading the theme files from disk and
parsing them.
In testing, caching this data in a transient improves performance by
600ms. Since themes changes relatively infrequently, the cache hit rate
should be quite high.
We're registering the cache clean function in Server.php because
rest_api_init is too late.
The system status endpoint supports the global `_fields` query parameter
for limiting which fields are returned. That is, if you send a request
with a query string of `?_fields=environment`, only the environment
property will be returned. However, we still calculate every property.
This change ensure that we only gather the data that is necessary for
the response. Since some of this data can be somewhat slow (like reading
from the disk in the case of get_theme_info), this could have a pretty
nice performance benefit in some cases.
PNPM does not run "pre" and "post" scripts
for user-defined scripts. This commit
removed the "preuglify" script from the
beta tester plugin so that it builds correctly.
Adds the following fields to the order response object for both v2 and v3 of the WC REST API:
* is_editable
* needs_payment
* needs_processing
Some order states (different than statuses) are determined by complex logic involving other order properties, and/or they are filterable by extensions. These states are difficult to calculate in a client app whose only data source is the REST API, and thus they are best calculated on the server and added as separate properties to the API response object.
When the "products/batch" endpoint is used to create or update products,
the product attributes lookup table wasn't being updated as it's the
case of the single product endpoints.
When WooCommerce was updated from an version older than 6.2,
and before the user hit the "Update database" button, the product
attributes lookup table usage was activated but it was still empty.
This caused the search to not work, and the product filtering widget
to not appear.