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

Stop extending the interal WooCommerce Core DataStores #712

Open
prettyboymp opened this issue Oct 29, 2024 · 0 comments
Open

Stop extending the interal WooCommerce Core DataStores #712

prettyboymp opened this issue Oct 29, 2024 · 0 comments

Comments

@prettyboymp
Copy link
Contributor

Description

As noted in https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/src/Internal#the-internal-namespace, the Internal namespace of WooCommerce core is intended to be internal only and provides no guarantee that the interfaces within it will not change.

WooCommerce Subscriptions currently goes against this policy suggestion and extends some of these datastore classes. This has the following reprecussions:

  1. As a WooCommerce official extension, it provides the community of the developers that look at these extensions for patterns on how they should integrate into and extend WooCommerce with an example that is contrary to the suggested practice.
  2. It isn't forward compatible. If WooCommerce core needs to change the underlying behavior of the datastores, we can't have any confidence that these extended classes will still work as expected. The ovewritten protected methods may no longer get called or, worse, have the a changed signature causing a fatal error.

Dev notes

If a custom datastores are needed, we should consider wrapping the internal datastore instance and delegating to it for any direct storage manipulation that it normally manages, e.g. DB and cache.

I also believe it is possible that a custom datastore for WooCommerce subscriptions isn't needed at all, but there are currently things in the datastores that are probably better suited to be managed by the data object classes themselves. Either way, making this change will likely require making updates to WooCommerce core to accomodate the needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant