Skip to content

Sign-up fee discount not applied when switching subscription #726

Open
@annemirasol

Description

Describe the bug

Reported by @allie500 in p1731683240284119-slack-C055WHLA98D:

A merchant has reported an issue with applying a sign up % discount coupon when a shopper with an active subscription of a variable subscription product switches to a new variation with a sign up fee. The coupon percentage is not applied to the sign up fee.

The HE who escalated the issue to Woo-Devs was able to replicate the issue. I spun up a JN site and was also able to replicate the issue. I also didn't see anything relevant in the debug.log file nor the wc-logs.

When I applied the coupon no exception or errors were thrown. The coupon was showing up on the page but the percentage amount was not deducted from the sign up fee.

Processing the order resulted in the full sign up fee being charged. I checked the coupons page in the wp-admin and it shows that the coupon has one usage.

To Reproduce

  1. Go to the coupon page in the wp-admin and make note of the current usage number for the coupon.
  2. Buy the annual variation of the subscription.
  3. Confirm the order was successful.
  4. Then on the my account page go to the subscriptions subpage and click the upgrade or downgrade button.
  5. Select the lifetime variation.
  6. Apply the coupon: lifetime20
  7. Observe that the amount due is not updated to reflect a 20% discount on the sign up price.
  8. Observe that the coupon is successfully added to the order.
  9. Finish checkout.
  10. Go to the coupons page in the wp-admin and confirm that the number incremented.

Expected behavior

Sign up fee coupons get applied when upgrading/downgrading subscriptions.

Actual behavior

Sign up fee coupons get ignored when upgrading/downgrading subscriptions.

Product impact

  • Does this issue affect WooCommerce Subscriptions? yes
  • Does this issue affect WooCommerce Payments? no

Additional context

Initial investigation by @annemirasol traced the behavior to

if ( ! $is_switch && WC_Subscriptions_Product::get_sign_up_fee( $cart_item['data'] ) > 0 ) {
, which seemingly skips "switches" on purpose when computing sign-up fee discounts.

Metadata

Assignees

Labels

type: bugThe issue is a confirmed bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions