Skip to content

Conversation

@jonathansadowski
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

This PR updates the method to update coupon usage counts such that it releases coupon holds on an order changed to cancelled status, regardless of whether or not coupon usage has been recorded. This releases coupon holds for cancelled orders that were previously in pending state so that they can be used by a new cart.

Closes #26741.

How to test the changes in this Pull Request:

  1. Apply this PR.
  2. Create a new coupon with usage limits. Set both the usage limit per coupon and the usage limit per user to 1.
    image
  3. From WooCommerce -> Settings -> Payments, make sure the PayPal payment method is enabled.
  4. Manage the settings for the PayPal payment method, and select "Enable PayPal sandbox".
  5. Create (or use an existing) sandbox application from the PayPal Developer Dashboard. Enter your sandbox credentials into WooCommerce and save the changes.
  6. Add an item to your cart, and apply the coupon code you previously created.
  7. Proceed to checkout. Your coupon should be applied to your order.
  8. Select PayPal as your payment method, and select "Proceed to PayPal".
    image
  9. When shown the login screen for PayPal, select "Cancel and return to Merchant".
    image
  10. Verify that the coupon still exists in your cart, and that if you checkout successfully (either with PayPal, or another payment method), the coupon is still applied.
  11. Verify that after using the coupon successfully, the usage restrictions are still enforced. You should not be able to use the coupon a second time.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Fix: Release coupon holds for cancelled orders previously in pending status.

Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!

@Konamiman
Copy link
Contributor

Tested and works as expected.

@Konamiman Konamiman self-requested a review August 7, 2020 09:26
@Konamiman Konamiman merged commit a13a0d2 into master Aug 7, 2020
@Konamiman Konamiman deleted the fix/26741 branch August 7, 2020 09:27
@woocommercebot woocommercebot added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 7, 2020
@juliaamosova juliaamosova added status: testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: add changelog Mark all PRs that have not had their changelog entries added. [auto]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage limit for discount error

6 participants