-
Notifications
You must be signed in to change notification settings - Fork 210
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
Order wrapper class proposal #3654
base: develop
Are you sure you want to change the base?
Conversation
Hey team! I would like to have your opinion on this proposal (@Mayisha , @diegocurbelo , @mattallan , @annemirasol ). What do you think? |
I love that we're consolidating order metadata getters and setters, and abstracting specifics, like the actual key names. I haven't looked at all the changes closely, but I think it's a refactor worth pursuing, @wjrosa. Thanks for making the effort. |
Nice, Anne! I will update this PR and properly move this to review so everyone can have a better look at the idea. |
Hey @woocommerce/quark! I have finished polishing my idea here. I'd appreciate it if you could at least tell me if it is OK to move this forward. I believe it is a great quality of life improvement. All possible meta keys, getters, setters, and retrieval methods are in one place. This also makes our WC_Stripe_Helper class smaller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smoke test results
Account connection
✅ Connect to Stripe account
✅ Reconfigure webhook
Simple product
✅ Card
✅ WeChat
✅ Multibanco
✅ klarna
✅ iDeal
Subscription
✅ Card
✅ Cash App
🔴 Renewal - subscription renewal from subs edit page results in a fatal error
Refund
✅ Tested refund with a couple of payment methods for simple and subscription product.
Capture Later
✅ Tested with card.
Additional note
Changes needed
- Need to update the deprecation version from
9.1.0
to the latest one. - Added a few comments.
Post merge action item
- Create a follow-up issue to remove deprecated functions in the future.
- Inform Quark and Fractal members to use this wrapper going forward.
- Include rigorous testing instructions for order related features for GS before the release.
Co-authored-by: Mayisha <[email protected]>
Co-authored-by: Mayisha <[email protected]>
includes/class-wc-stripe-helper.php
Outdated
if ( is_null( $order ) ) { | ||
return false; | ||
} | ||
|
||
$order->delete_meta_data( self::META_NAME_FEE ); | ||
$order->delete_meta_data( self::LEGACY_META_NAME_FEE ); | ||
$order->delete_fee(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$order->delete_fee(); | |
$order->delete_meta_data( self::META_NAME_FEE ); | |
$order->delete_meta_data( self::LEGACY_META_NAME_FEE ); |
@wjrosa I am still getting the fatal error when I try to renew a subscription from the subscription edit page. The reason is , though it's calling this helper method now, the helper method itself tries to call the function from the new order wrapper class.

This helps to realize another problem, if any third party plugins are using these helper methods, they would send an instance of WC_Order
here, not WC_Stripe_Order
. So we should keep the previous code in these functions.
Similar changes (reverts) should be made for other functions here as well to avoid breaking plugin compaatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, sorry about that! I reverted the changes on the deprecated methods and added extra checks for the object class type on the latest commits.
Changes proposed in this Pull Request:
This PR is a proposal for introducing a new children class (
WC_Stripe_Order
, extended fromWC_Order
) that wraps all our custom metadata and extension-specific business logic. This should make it easier to reference and change metas.Testing instructions
-- Connect your Stripe account
-- Enable some payment methods
-- As a shopper, make some purchases
* Unit tests for the new class will be added if this proposal gets approved
changelog.txt
andreadme.txt
(or does not apply)Post merge