woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
312 stars 112 forks source link

Custom field details validation rules #13888

Closed hafizrahman closed 1 week ago

hafizrahman commented 2 months ago

Rules are:

  1. Disallow entering keys that start with "_"
  2. key is always required
  3. value can be empty
  4. key must not be a duplicate from existing local keys, because the API doesn't allow adding duplicate key:
  • When adding a new field, the app should check the local storage for duplicate keys, and if any duplicates are found, it should show an alert that explains that the field can’t be added from the app, but it can be done from wp-admin.
  • When editing an existing field, there is no need for the check, as existing fields are identified by their ids and not their keys.

The validation should show inline error, e.g:

https://github.com/user-attachments/assets/06fd27b3-fc8e-4a43-ac8d-676f6962c329

dangermattic commented 2 months ago

🚫 Please add a type label (e.g. type: enhancement) and a feature label (e.g. feature: stats) to this issue.