woocommerce / woocommerce-ios

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

[Min/Max Quantities Edit Support] UI + Sync Logic #12758

Closed toupper closed 1 week ago

toupper commented 2 weeks ago

Closes: #12718

Description

With this PR we implement the edit support for Min/Max Quantities in the product and variations detail forms.

Testing instructions

Store without the Min/Max Quantities plugin installed. We don't show the Min/Max Quantities row in product and product variation details:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product
  4. You don't see any row about the Min/Max Quantities:

Simulator Screen Recording - iPhone 15 - 2024-05-15 at 10 25 12

Store with the Min/Max Quantities plugin installed, but no values set in product. We show the Quantity Rules row with no rules:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product
  4. You see any row about the Min/Max Quantities row without any rule:

Store with the Min/Max Quantities plugin installed, and values set in product. We show the Quantity Rules row with rules:

Quantity Rules screen shows values and placeholder when there is none:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product
  4. Tap on the Quantity Rules row.
  5. It opens the Quantity Rules screen with placeholders:

Edit Quantity Rules:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product
  4. Tap on the Quantity Rules row.
  5. Edit Quantity Rules with happy path (valid values):

https://github.com/woocommerce/woocommerce-ios/assets/1864060/4330b456-8442-4c72-858b-f68b29859835

Product Variations:

We show the Quantity Rules row in product variations detail views if:

These two latter values can be set in wp-admin (Not in the app in this milestone)

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product with variations.
  4. Tap on any variation.
  5. Tap on the Quantity Rules row
  6. You can edit the Quantity Rules

https://github.com/woocommerce/woocommerce-ios/assets/1864060/400866c5-ae10-4f6c-ace8-2ba1d486bf73

Errors:

We show the errors messages returned from the requests. These are

"woocommerce_rest_invalid_max_quantity"
"woocommerce_rest_invalid_min_quantity"
"woocommerce_rest_invalid_variation_max_quantity"
"woocommerce_rest_invalid_variation_min_quantity"

As these errors are dynamic, we can test if we show the right message by debugging the code or inspecting the response with Proxyman. You can test the behavior with inconsistent input:

Example: Entering a min value bigger than the maximum:

https://github.com/woocommerce/woocommerce-ios/assets/1864060/1409b74f-d083-474c-a13c-c060db213ba3

Screenshots

See above


wpmobilebot commented 2 weeks ago

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr12758-55663c4
Version18.6
Bundle IDcom.automattic.alpha.woocommerce
Commit55663c4ee9144955187b86816b804c75919bb9a7
App Center BuildWooCommerce - Prototype Builds #9116

Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.