Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Product traits compatibility #44585

Open
wants to merge 4 commits into
base: try/persisted-product-form-templates
Choose a base branch
from

Conversation

joshuatf
Copy link
Contributor

Changes proposed in this Pull Request:

This POC adds a trait system for declaring compatibility with other traits. It does the following:

  • Sets up an abstraction where traits can be declared
  • Moves trait specific methods into that class
  • Adds trait metadata to blocks
  • Hides blocks when incompatible traits are turned on

Follow-ups to consider for this PR:

  • Allow compatibility for existing traits to be filtered (can technically already be done by using the woocommerce_simple_product_traits filter, but might be too complex)
  • Replace and deprecate product types (POC in progress)
  • Cross-trait compatibility (detecting declared or undeclared compatibility in the opposing trait)
  • Server-side validation of trait compatibility

How to test the changes in this Pull Request:

Screenshot 2024-02-13 at 10 24 19 AM
  1. Navigate to the Add New Product page with the new product editor experience enabled
  2. Click on the "Virtual" toggle
  3. Notice that the "Shipping" tab is hidden
  4. Optionally make a call to http://test.local/wp-json/wp/v2/template-parts?area=product-form and notice the productTrait data in the block

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@joshuatf joshuatf requested a review from a team February 13, 2024 15:36
@joshuatf joshuatf self-assigned this Feb 13, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 13, 2024
Copy link
Contributor

Hi , @woocommerce/mothra

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant