Skip to content

Conversation

@fitimvata
Copy link
Contributor

@fitimvata fitimvata commented Jun 29, 2021

All Submissions:

Changes proposed in this Pull Request:

In rest endpoint for creating refunds restock_items was hardcoded with value true. With this changes, this parameter can
be changed by client directly. I opened this pull request because i have a use case when i need to refund order from rest api but not restock the items.

How to test the changes in this Pull Request:

  1. Create an order with a product whose stock is managed either via the API or otherwise.
  2. Before applying this PR, refund the order using the API. Verify that the stock is restored.
  3. Apply this PR.
  4. Create a new order.
  5. Refund the order using the API. Do not specify the api_restock parameter. Verify that the previous behavior (defaults to true) remains, and that the stock is restored.
  6. Create a new order.
  7. Refund the order using the API, this time specifying the api_restock parameter with a false value. Verify that the stock is not restored.

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

Tweak - Allow the api_restock parameter to be specified via the refunds API, so that it's possible to refund without restocking refunded items.

@fitimvata
Copy link
Contributor Author

@jonathansadowski I have one question. Will this PR be included for the next release? Thanks.

@jonathansadowski jonathansadowski self-requested a review June 30, 2021 13:12
Copy link
Contributor

@jonathansadowski jonathansadowski left a comment

Choose a reason for hiding this comment

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

@fitimvata Thanks for your PR, I tested it and it's working well. When I don't provide the api_restock parameter, it defaults to true, and when I specify it as false, as expected, the line items that I refund are not restocked.

I just left a minor suggestion for the description within the schema — this is to better match the wording that's shown within the refund interface (and hopefully alleviate potential confusion).

@jonathansadowski
Copy link
Contributor

I have one question. Will this PR be included for the next release? Thanks.

It's too late to include this in WooCommerce 5.5. I'm going to add it to the 5.6 milestone, and let's target it for inclusion there.

@jonathansadowski jonathansadowski added this to the 5.6.0 milestone Jun 30, 2021
@fitimvata
Copy link
Contributor Author

I have one question. Will this PR be included for the next release? Thanks.

It's too late to include this in WooCommerce 5.5. I'm going to add it to the 5.6 milestone, and let's target it for inclusion there.

Can you make an exception we need this asap in our company. If it is not possible, do you have an ETA for 5.6?

@jonathansadowski
Copy link
Contributor

jonathansadowski commented Jul 1, 2021

Can you make an exception we need this asap in our company. If it is not possible, do you have an ETA for 5.6?

@fitimvata, unfortunately, we will not be able to make any exception. WooCommerce 5.6 is slated for final release on the 2nd Tuesday in August — August 10th, with Beta and Release Candidate currently slated for July 20th and July 27th respectively.

Thanks for making the update requested, and for the initial PR. I'm going to merge this into trunk!

@jonathansadowski jonathansadowski merged commit 1c1f6fd into woocommerce:trunk Jul 1, 2021
@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 Jul 1, 2021
@fitimvata
Copy link
Contributor Author

Thank accepting this pr @jonathansadowski

@claudiosanches claudiosanches removed the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Jul 16, 2021
@tammullen tammullen added the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Jul 16, 2021
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] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants