Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
173 stars 69 forks source link

Shipping cost not getting updated for a subscription after purchased #3193

Open a-danae opened 3 years ago

a-danae commented 3 years ago

Note This issue is being addressed in subscriptions-core. https://github.com/Automattic/woocommerce-subscriptions-core/issues/218

Describe the bug

After purchasing a subscription that requires shipping, updating its shipping address doesn't change the shipping cost associated with the subscription.

To Reproduce

  1. Go to WooCommerce -> Settings -> Shipping
  2. Add a Shipping zone for California. Select "Free shipping" for this zone
  3. Create another shipping zone for the US. Select "Flat rate" with a cost of 10 USD
  4. Make sure Billing clocks is enabled (WC Pay Dev tools)
  5. Go create a new product. Make it a Simple subscription. Add a name, and set its price to 20 USD per week
  6. As a shopper, add this product to the cart and proceed to checkout
  7. Fill up the form. In the shipping address, choose United States and select "Florida" in the state (Notice that if you change the shipping state to California, you get Free shipping) | Error Message | Florida (or any other state) | | image | image |
  8. Select a valid card and make the purchase
  9. Go to the admin side, WooCommerce -> Subscriptions -> Edit the subscription you just purchased
  10. In the sidebar at the right, enable Dev Testing Mode
  11. In incognito, log in with the newly created user (password = password) and go to My Account -> My subscription
  12. Click on "Change address", update your shipping address to one in Florida and save. Notice it says "Both the shipping address used for the subscription and your default shipping address for future purchases will be updated"
  13. Go back to edit the subscription on the admin side. Trigger the invoice.upcoming event
  14. Check out the subscription on Stripe (there's a link in the Dev Testing Mode), and notice the upcoming invoice is 30 USD because it includes the shipping cost, even though the updated address has free shipping. If you keep triggering upcoming events, you'll see this amount does get paid later on. This behavior is the same when the subscription handles taxes that vary depending on the address image

Actual behavior

Shipping (and taxes) cost doesn't get updated on renewals when the shipping address for the subscription is updated.

Expected behavior

As a shopper, I'd expect the shipping and taxes costs to be updated on my subscription if I change the shipping address under My Account -> My Subscription.

As a merchant, I'd expect the shipping and taxes costs to be updated if I updated the subscription's shipping address under WooCommerce -> Subscriptions -> The subscription to edit.

james-allan commented 2 years ago

Thanks for the report @a-danae!

I believe this issue also affects the WC Subscriptions plugin. There's an open issue over there with a draft PR IIRC.

3747-gh-woocommerce/woocommerce-subscriptions

From a WC Pay Subscriptions context, we'll just need to make sure the shipping is updated at Stripe when it's updated in WC.

a-danae commented 2 years ago

Oh, I missed that issue. Thanks @james-allan!

haszari commented 2 years ago

Re-prioritising this as low since we haven't had any reports from merchants. Please comment/ping if this should be prioritised or we get reports from merchants!

haszari commented 2 years ago

Switched to high priority as this has been reported as a significant pain point/gap by merchants, and work is underway to improve it.