When using the Product Add-ons plugin and you pay for a subscription renewal, failed initial order or resubscribe, we were telling Product Add-ons to not adjust the price.
This caused issues when paying for initial parent orders because we (subscriptions) don't automatically grandfather the price and so we need Product Add-ons to actually calculate the add-on prices in that case.
This PR fixes that by making sure we only tell Product Add-ons to not adjust prices if we're going to honour the order/subscription total. To help explain, this little table explains what the cart product price source should be for the various scenarios:
Order type
Price Source
Parent
product price + Add-ons
Parent w' price lock *
subscription/order
Renewal
subscription/order
* you can lock the parent order price by editing the order and hitting this checkbox
How to test this PR
Install the WooCommerce Product Add-ons plugin.
Create a subscription product with at least 1 product Add-on.
Go the product page on the front end, choose an add-on and then add the product to the cart.
At checkout fail the payment using a failing payment method.
Go to the My Account Orders page and click the "Pay" link.
On trunk you'll notice 2 things.
The order price will be wrong. It doesn't include the add-on prices.
The add-ons are doubled up (screenshot) - you can ignore this for now.
On this branch the total price should be correct. ie include the add-on(s) prices.
Edit the order in the admin dashboard.
Change the order's status to pending.
Edit the line item total and increase the price.
Check the "lock manual price increases" box.
Save
Repeat step 5 from above.
On trunk the price is correct (the increased price).
On this branch the total price should still be correct (the increased price).
Create a pending renewal order for a subscription with product add-ons.
Attempt to pay for it through the cart, the cart total should always match subscription/renewal order.
The add-ons are doubled up (screenshot) - you can ignore this for now.
This doubling up of the add-ons will need to be fixed in the Product Add-ons plugin. I've got some working changes that I'll submit to their repo.
Product impact
[x] Added changelog entry (or does not apply)
[ ] Will this PR affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[ ] Will this PR affect WooCommerce Payments? yes/no/tbc, add issue ref
[ ] Added deprecated functions, hooks or classes to the spreadsheet
Part of https://github.com/woocommerce/woocommerce-subscriptions/issues/4535
Description
When using the Product Add-ons plugin and you pay for a subscription renewal, failed initial order or resubscribe, we were telling Product Add-ons to not adjust the price.
This caused issues when paying for initial parent orders because we (subscriptions) don't automatically grandfather the price and so we need Product Add-ons to actually calculate the add-on prices in that case.
This PR fixes that by making sure we only tell Product Add-ons to not adjust prices if we're going to honour the order/subscription total. To help explain, this little table explains what the cart product price source should be for the various scenarios:
* you can lock the parent order price by editing the order and hitting this checkbox
How to test this PR
trunk
you'll notice 2 things.trunk
the price is correct (the increased price).This doubling up of the add-ons will need to be fixed in the Product Add-ons plugin. I've got some working changes that I'll submit to their repo.
Product impact