* add api-core-tests for system status
* add api-core-tests for system status
* add system status api-core-tests
* add system status api-core-tests formatting updates
* Allow additional props to be passed to the Form getInputProps method
* Remove getTextControlProps
* Pass additional shared props through getInputProps in shipping
* Simplify checkbox props
* Unwrap currency props
* Use onBlur event to sanitize prices
* Add changelog entry
* Add option to get checkbox props to form context helpers
* Update checkbox tracks handler naming and typing
* Fix up usage of getInputProps
* Add helper sanitize method
* Use sanitize helper method for product input fields
* Fix inventory input props after rebase
* Fix shipping typo
* Fix up form types after rebase
* Align all checkboxes on product page
* Rename new checkbox helper to getCheckboxControlProps
* Add helper method to get select control props
* Add data changelog entry
* Check for product name length on blur
* Add initial value for name to prevent uncontrolled value
* Add initial value for sku
* Fix trashing/untrashing orders when using COT:
- Trashing wasn't changing the update date on the orders table record.
- Trashing wasn't applying trash on the corresponding post.
- Untrashing wasn't actually deleting _wp_trash_meta_status in metadata.
* Fix: maybe_sync_order was syncing even with identical update dates.
* PHPCS is happy now.
* WP_DIE when attempting to load a trashed order in Admin
(same behavior as when using the posts table)
* Add changelog file
* Revert change in order records date comparison
Data comparison is needed too when the dates are equal, since data in the metadata table could have been modified as well.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix handling of order status and trash meta when untrashing.
Untrashing an order was setting it to the default status of "pending"
instead of the previous status. This is what was happening:
1. Order is trashed, order meta table gets the value (e.g.) "on-hold"
for the _wp_trash_meta_status key
2. Post is trashed, post meta table gets "wc-on-hold"
3. Order is re-read, but then so is posts, and the order meta value is
updated to "wc-on-hold"
4. On untrash the previous order status from order meta table is
prefixed with "wc-", thus it becomes "wc-wc-on-hold", which is not
a valid status
5. Not having a valid status, the order is restored as the default
status of "pending payment"
To fix this, the previous status is stored in order meta table
with "wc-", and it doesn't get prefixed on untrash.
Also, wp_untrash_post is called on order untrash, otherwise the
trash metadata keeps dangling and being synced back and forth.
* Add unit tetst for the trash-untrash cycle
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix 'Invalid payment method' error upon double click 'Delete' #30862
An 'Invalid payment method' error shows when a user double clicks the
'Delete' button in the 'Add Payment method screen'. Every time the user clicks
the button, there is a GET request to delete the payment method. First request is
handled correctly, but subsequent requests throw an error, because the payment
method cannot be found since it was already deleted.
This adds an event handler to disable the button on the first
click.
* Add changelog entry
* Use AccessiblePrivateMethods in DataSynchronizer.
Also fix some code styling stuff.
* Introduce the woocommerce_feature_description_tip filter.
...and use it to display a warning for the COT feature
if there are orders pending sync.
* Display the plugin-feature incompatibility warning in all admin pages.
...except in the plugins list when we are already showing the
"You are viewing plugins with incompatibilities" page.
Also change the styling from warning to error.
* Add changelog file
* Revert accidental change.
Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
* Add initial add attribute modal
* Add async select control component and add attribute terms
* Make use of AsyncSelectControl for attributes
* Rearranged the add attribute form to make removing easier
* Make sure add button is disabled if fields are empty
* Remove the use of AsyncSelectControl for now
* Add disabled option and fix merge conflict
* Add attribute modal tests
* Remove unused trigger drag
* Add popover slot
* Small update to select control and fix multi selection in term field
* Add tests for attribute and attribute term fields
* Add changelogs
* Small fix after merge conflict
* Fix some styling and issue with select control when clearing item
* Fix lint error
* Fix up some styling issues after rebase
* Fix formatting, some styling issues, and address some PR feedback
* And confirmation dialog for closing the modal.
* Select the current new added shipping class
* Extracting constants into the right file
* Add unit tests
* Use setValue instead onChange to select the shipping class of the product
* Add label prop to rich text editor
* Create feature class and enqueue styles
* Add description editor and parsing
* Fix up incorrect context for product data
* Add styling to rich text editors in product form
* Fix editor initialization on new product
* Add changelog entries
* Use trunk lock file
* Add component changelog entry
* Update lock file
* Register block store provider in tests
* Fix up phpcs errors in product feature file
* Optimize is_complete() method
* Replaed WC_Product_Query with wp_count_posts, which has more optimized query
* Optimize TaskList::is_complete -- return early when false instead of running through all the tasks
* Cache is_complete() method for the tasks with db query
* Add changelog
* Add initial category field component with new typeahead
Move search logic to useCategorySearch hook
Add initial add new category logic
Add parent category field to add new category modal
Adding some debug changes
Update category control to make use of internal selectItem function of select control
Add changelogs
Update pagesize back to 100
Add placeholder
Empty placeholder
Fix input and icon sizes
Fix input underline
Add max height and scroll to category dropdown
Add sorting of category items
Auto open parents when traversing up the tree using arrow keys
Add several comments
Add some initial unit tests for the category field component
Add tests for useCategorySearch hook and fixed minor bug
Update styling and autoselect parent if child is selected
Fix styling issues for the select control dropdown inside a modal
Fix issue with creating new category with parent
Add function comment and fixed border styling
Prune out create new category logic
Fix minor css issue with border
Revert some of the select control changes and make use of the custom type
Fix up some styling changes
* Fix type conflict
* Revert change in state reducer
* Add cursor pointer
* Fix styling errors
* Fix broken category tests
* Fix merge conflict
Make the quantity input visible, even if the min and max allowed values are identical.
* Add changelog
* Update plugins/woocommerce/changelog/fix-GH-34280
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Update plugins/woocommerce/templates/global/quantity-input.php
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix `@since` tag
* Use a single readonly input (when quanity cannot be changed) instead of two inputs (hidden and disabled).
* Introduce consistent formatting when a product is sold individually and when the min/max is identical.
* Update `@version` tags to 7.1.0.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Set correct timezone when backfilling data.
* Add changelog.
* Apply code standards.
* Address further flakiness and more comprehensive test.
* More fixes for timezone backfil.
* Remove unnecessary comments.
* Revert test change since we are not changing systems timezone.
* Minor alignment fix.
* Minor language fix.
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
Co-authored-by: Peter Fabian <peter.fabian.github@gmail.com>
* Add and use ON_DUPLICATE_KEY update function to perform update/insert without additional query.
* Fix typo
* Add more tests for save related functions.
* Update post directly to update correct post_modified value.
If we use wp's update_post function, then it will set the post-modified date to current time(). This is not desirable when backfilling order data where we want post data to be exactly the same as orders.
* Add changelog.
* Add support to sync from posts table when reading order table.
When sync is enabled, we also read from posts table when an order is read from COT. Mismatch in this case implies a direct write and therefore we update the COT record with data from posts. This provides an additional layer of backwards compatibility.
* Add more tests for different tables.
* Modify sync logic to account for metadata that has been changed.
* Fetch post only when data sync is enabled.
* Made test case comparison more strict to prevent flakiness.
* WIP
* WIP
* Added protections and code standard fixes.
* WIP
* Change order data store internal key to props for better representation.
* Add changelog
* Add legacy datastore prop for WC_Data object to support COT.
* Also support passing in `get_stock_reduced` method.
* Add internal meta keys to order table data store.
* Add tests for CPT datastore for orders.
* Change return type to prevent implicit type conversion.
* Use correct conversion.
* Revert "Use correct conversion."
This reverts commit 97ead11f71.
* Add conversions to test as needed.
* Add internal keys for order table data store for consistency.
* Apply code standards.
* Merge conflict fixes.
* Add more tests.
* Add more fixes and unit test for sync logic.
* Remove $save param for consistency with parent class.
Earlier, we added the $save parameter for performance reason, but now that we are storing the props in the WC_Order object, this isn't needed anymore (as the object can hold the updated props).
* Return bool instead of string as described.
* Fix test by transforming bool values before confirming.
* Fix test by not needing to converting to string, since we now bool value.
* Store internal props as bool instead of string.
* Remove unused method.
* Only select props for refunds that are actually needed.
* Store bool as yes/no to maintain compatibility with how were storing prev.
* Fix unit test to extpect yes.
* Add tests and set special metadata migrated from data store correctly.
* Add tests for legacy prop get/set in ordertabledatastore.
* Update email class to use data store method instead of get_meta.
* Update exisiting tests to account for changes in legacy prop setting.
* Read from CPT store directly, and cache the pending value.
* Fixup in unit test.
* Add test for refund creation.
* Add test for refund creation.
* Remove strict WC_Order typecasting.
* Address code standard voilation.
* Call correct parent method for updating meta.
* Use WC_Absract instead of WC_Order to provide more compatibility.
* Record order ids we are syncing for to prevent any infinite loop.
* Add test for fixing infinite loop with read on sync.
* Address PR feedback.
* Fix formatting.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix formatting.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Use correct type hints.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix formatting.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Yoda, use.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Remove space between minus and numeral for readability.
* Fix ut, and use assertTrue instead of native for consistency.
* Port a fix for edit date save.
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>