-
Notifications
You must be signed in to change notification settings - Fork 69
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
Enable ECE for shipping subscriptions with free trial and sign up fee #9955
Draft
asumaran
wants to merge
11
commits into
develop
Choose a base branch
from
as-fix-ece-shipping-subs-with-free-trial-and-sign-up-fee
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+31
−14
Draft
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b3c6d87
Enable ECE for shipping subscriptions with free trial and sign up fee
asumaran b1f783f
Add changelog entry
asumaran 9336aa0
Merge branch 'develop' into as-fix-ece-shipping-subs-with-free-trial-…
asumaran 4f4554a
Fix Google Pay not working after clicking it after closing the payment
asumaran 4a6075f
Merge branch 'develop' into as-fix-ece-shipping-subs-with-free-trial-…
asumaran b0c8669
Remove unnecessary comment
asumaran 4ad046f
Tidy up code
asumaran 22b723b
Merge branch 'develop' into as-fix-ece-shipping-subs-with-free-trial-…
asumaran 0e75740
Fix duplicated sign_up_fee check
asumaran ec290c7
Remove unnecessary comment line
asumaran 324452b
Merge branch 'develop' into as-fix-ece-shipping-subs-with-free-trial-…
asumaran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/as-fix-ece-shipping-subs-with-free-trial-and-sign-up-fee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: fix | ||
|
||
Enable ECE for shipping subscriptions with free trial and sign up fee. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -742,7 +742,6 @@ public function get_product_data() { | |
$data['needs_shipping'] = ( wc_shipping_enabled() && 0 !== wc_get_shipping_method_count( true ) && $product->needs_shipping() ); | ||
$data['currency'] = strtolower( $currency ); | ||
$data['country_code'] = substr( get_option( 'woocommerce_default_country' ), 0, 2 ); | ||
$data['product_type'] = $product->get_type(); | ||
|
||
return apply_filters( 'wcpay_payment_request_product_data', $data, $product ); | ||
} | ||
|
@@ -765,12 +764,13 @@ private function is_product_supported() { | |
if ( is_null( $product ) || ! is_object( $product ) ) { | ||
$is_supported = false; | ||
} else { | ||
// Simple subscription that needs shipping with free trials is not supported. | ||
$is_free_trial_simple_subs = class_exists( 'WC_Subscriptions_Product' ) && $product->get_type() === 'subscription' && $product->needs_shipping() && WC_Subscriptions_Product::get_trial_length( $product ) > 0; | ||
// Applies to case 3 from matrix: https://github.com/Automattic/woocommerce-payments/issues/9771#issuecomment-2518829514. | ||
// Note: This does not check variable subscriptions, as that will be handled on the frontend. | ||
Comment on lines
+781
to
+782
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
$is_free_trial_simple_subs_no_sign_up_fee = class_exists( 'WC_Subscriptions_Product' ) && $product->get_type() === 'subscription' && $product->needs_shipping() && WC_Subscriptions_Product::get_trial_length( $product ) > 0 && WC_Subscriptions_Product::get_sign_up_fee( $product ) === 0; | ||
|
||
if ( | ||
! in_array( $product->get_type(), $this->supported_product_types(), true ) | ||
|| $is_free_trial_simple_subs | ||
|| $is_free_trial_simple_subs_no_sign_up_fee | ||
|| ( class_exists( 'WC_Pre_Orders_Product' ) && WC_Pre_Orders_Product::product_is_charged_upon_release( $product ) ) // Pre Orders charge upon release not supported. | ||
|| ( class_exists( 'WC_Composite_Products' ) && $product->is_type( 'composite' ) ) // Composite products are not supported on the product page. | ||
|| ( class_exists( 'WC_Mix_and_Match' ) && $product->is_type( 'mix-and-match' ) ) // Mix and match products are not supported on the product page. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This works well, but I wonder if adding more details to this comment here could help others understand the logic more quickly. I think linking to the PR makes sense, but just to provide additional context, not using as the main source of documentation.