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

Do not unset package contents for Shipping Subscriptions with free trials #746

Closed
wants to merge 3 commits into from

Conversation

asumaran
Copy link
Contributor

@asumaran asumaran commented Dec 13, 2024

Fixes Automattic/woocommerce-payments#9771

Description

Enables shipping options for variable subscriptions with free trial.

How to test this PR

To be tested along with Automattic/woocommerce-payments#9955

@asumaran asumaran force-pushed the as-fix-ece-shipping-subs-with-free-trial branch from c76a421 to 4aa8554 Compare December 13, 2024 19:37
@asumaran asumaran marked this pull request as ready for review December 14, 2024 00:32
@asumaran asumaran self-assigned this Dec 14, 2024
@mattallan
Copy link
Contributor

mattallan commented Dec 19, 2024

Hey @asumaran thanks for opening this PR and for all your investigation into this issue on WooPayments.

I had to go through the history books to find our why we unset shipping packages and it looks like it's always been this way (since we introduced multiple subscriptions per checkout in v2.0).

It also appears to be the intended behaviour as per our FAQ documentation, which states:

If your subscription includes a free trial, shipping is free for that first period if no other products are purchased in the same transaction. To charge an up-front shipping fee for a subscription with a free trial, you can include a signup fee for the cost of shipping.


There's a few things changing with removing this block that I wanted to call out:

  1. Parent orders of a trial subscription will now have a shipping line item
develop This branch
image image

Warning

This PR introduces a bug when you go through the block checkout. The order summary on the checkout page shows that flat rate shipping is "FREE" but then when you purchase the order, it's actually charged $10 for shipping.

Ignoring the bug above. I'm not overly opposed to this change overall but it does change the fundamentals for how we've handled shipping on the initial order of trial subscriptions.

I don't know why merchants would ship a free trial, but if it does need shipping, then there should probably be a shipping line item. This feels like it should be a whole setting on its own i.e. ask merchants if the trial period requires shipping.

Our current approach of telling merchants to include a signup fee to record shipping costs feels very outdated and I'm assuming this wouldn't work well with shipping extensions that use shipping line items to do things like attach tracking numbers etc.

  1. Customers can now choose a shipping option on the checkout page for their initial trial product and a different shipping option for their recurring subscription.
develop This branch
image image

I think this will be confusing to customers and could potentially catch merchants by surprise. I don't think a merchant would want customers picking an Express shipping method for their trial product (which will be set to $0) and then some cheaper option for the recurring orders.

  1. The shipping cost is set to 0 for free-trials regardless of which shipping option is selected. i.e. Express post and free shipping will both be set to $0.
develop This branch
image image

Similar to the above point. Regardless of the shipping method chosen, if the parent order is for a free trial, we set the cost to $0. Not sure if merchants may be confused seeing a new order come in with a shipping line item for Flat rate but no shipping was charged.


There's another change coming in this PR that I would consider a bug/break.

  1. Synced subscriptions that are purchased before the synced date shouldn't have a shipping line item or prompting the customer to choose a shipping option for the initial purchase.

Say a store sells a subscription product that's synced to the 1st of the month. We apply a mock trial period on the cart item for the period between purchase date and the synced payment date. When a customer purchased this product on the 15th, this order doesn't need shipping and shouldn't have a shipping line item.

@asumaran
Copy link
Contributor Author

@mattallan, thank you for sharing your thorough feedback on my changes in this PR. I was uncertain about the simplicity and isolation of my changes. I’ll address each of your points but first, I want to focus on getting the WooPayments PR ready, and then I’ll shift my focus to this side of the issue.

@asumaran
Copy link
Contributor Author

asumaran commented Jan 7, 2025

Closing this PR since Tokenized Carts is now the default implementation in WooPayments. This allows us to get the data we need more accurately.

What we were previously doing here felt pretty hacky to prevent the removal of shipping options from the package when a subscription included free trial and a sign-up fee (by using a filter controlled from WooPayments). To be honest, I wasn’t very happy with that solution.

However, with Tokenized Carts (which uses the Store API), the shipping options information is available in extensions.subscriptions of the Store API response making this PR no longer necessary.

Closing this in favor of Automattic/woocommerce-payments#10099

@asumaran asumaran closed this Jan 7, 2025
@asumaran asumaran deleted the as-fix-ece-shipping-subs-with-free-trial branch January 7, 2025 18:50
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

Successfully merging this pull request may close these issues.

ECE buttons not rendered for variable subscription products on the product details page
2 participants