-
Notifications
You must be signed in to change notification settings - Fork 217
Allow purchase of free trials with ECE #4557
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Thanks for adding this long awaiting feature @wjrosa 🎉
I can see the ECE buttons for free trial subscriptions now on product, block cart and block checkout page. I could successfully purchase a free trial subscription using block checkout. However, I do not see the ECE button on classic cart and classic checkout pages. Could you check if this is the same for you?
@@ -1,6 +1,7 @@ | |||
*** Changelog *** | |||
|
|||
= 9.9.0 - xxxx-xx-xx = | |||
* Add - Allow the purchase of free trials using the Express Payment methods when the product does not require shipping |
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.
QQ: why is it supported only for the products that do not require shipping? Is there any catch with the shippable products?
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.
I am honestly not sure. The original comment was included by you here. I just kept the limitation 😅 . However, maybe it is not needed at all (I can't imagine any reasons why it would be). Original code:
// Don't show if the total price is 0.
// ToDo: support free trials. Free trials should be supported if the product does not require shipping.
if ( ( ! ( $this->is_pay_for_order_page() || $this->is_product() ) && 0.0 === (float) WC()->cart->get_total( false ) )
|| ( $this->is_product() && 0.0 === (float) $this->get_product()->get_price() )
) {
return false;
}
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.
Let me try to remember the reason 🤔
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.
Okay, so I don't exactly remember the reason but I remembered following what we have in WooPayments. I found this epic where item 3 says the expected behavior is ECE would be hidden. This epic was created later but there were something in WooPayments that I followed at that time 🤔
Not a blocker for this PR, but we should assess separately if support for shippable products should/can be added.
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.
Thanks for the additional context! Yeah, I think we can tackle this specific rule later. I created STRIPE-715 for that
client/express-checkout/utils/check-payment-method-availability.js
Outdated
Show resolved
Hide resolved
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.
Nice work! I think Mayisha's review captured everything pretty well. This works well on the Blocks checkout. I am not certain how much of an effort it would be to support shortcode, but if we want to ship the current work first, let's update the changelog entry to reflect that.
Thanks for the review, folks! The shortcode checkout should be fixed by ea853ca |
Fixes STRIPE-240
Changes proposed in this Pull Request:
Our current implementation of the Express Checkout Element does not support free trials for subscriptions. I am adding support for that here.
We are basically checking for free trials on the backend, providing this informantion to the frontend, and changing two payment element parameters based on that:
mode
: setting it tosubscription
(docs)paymentMethodCreation
: setting it tomanual
(docs)Testing instructions
add/allow-ece-purchases-for-free-trials
)Changelog entry
Changelog Entry Comment
Comment
Post merge