Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

Replace limited-subscription-notice with something more relevant when no variation is added to cart #557

Open AashikP opened 5 months ago

AashikP commented 5 months ago

Describe the bug

If a Variable Subscription is not purchasable, it should display a relevant / generic message rather than an incorrect notification that says the product is already in cart: /templates/single-product/add-to-cart /variable-subscription.php

To Reproduce

Use a plugin that can restrict a product. I'm using WooCommerce Memberships here.

  1. Create a simple Subscription product as well as a variable subscription product

  2. Create a membership plan (membership settings for the plan don't matter)

  3. Restrict both the simple as well as variable subscription to be purchased only with an active Membership plan:

    mjyB0V.png

  4. Check the Simple Subscription product and confirm that this is showing the correct notice:

    AWmOTU.png

  5. Check the variable subscription product to confirm that it is showing the following notice even though there's no product in cart:

    2nmwej.png

Expected behavior

Do not show incorrect notice - instead, maybe stick to a generic notice like this product cannot be added to cart in case it does not meet any of the existing conditions that prevent the product from being added to cart.

Actual behavior

Variable product shows You have added a variation of this product to the cart already even though there is no product in cart.

Product impact

Additional context

Customer report: 7562463-zen