woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
960 stars 472 forks source link

Hide the single product page quantity input, when the product is sold individually. #2086

Closed barryhughes closed 1 year ago

barryhughes commented 1 year ago

If a product is set to be sold individually, let's hide the quantity input.

Fixes #2085.

Screenshots

Regular Product Sold Individually
test-product-regular test-product-soldindiv

The above shows how things will look once this change is applied (the quantity input will be hidden, if the product is set to be sold individually).

How to test the changes in this Pull Request:

  1. Configure a product to be sold individually.
  2. View the corresponding single product page (and please test this against WooCommerce 7.2.0 or higher).
  3. With this change, the quantity input should be hidden.
  4. Without this change, the quantity input will still be visible.
  5. Confirm the quantity input always renders for products that are not set to be sold individually.

💡 When testing this branch, be sure to rebuild the stylesheets using npm run build:css. You may also need to clear your browser cache to see the change.

Changelog

Fix – Hide the single product page quantity selector if the product is sold individually. #2085

barryhughes commented 1 year ago

Closing: we've reverted the corresponding change in WooCommerce (when the input should be hidden, it will once again be set to type="hidden") and so no longer require a CSS solution.