Skip to content

Conversation

@rrennick
Copy link
Contributor

@rrennick rrennick commented Nov 21, 2018

All Submissions:

Changes proposed in this Pull Request:

Closes #21754 .

How to test the changes in this Pull Request:

  1. Rebuild admin.css sass assets/css/admin.scss assets/css/admin.css.
  2. Enable the manual stock adjustment buttons add_filter( 'woocommerce_order_allow_manual_stock_adjustment', '__return_true' );.
  3. Create a new order with at least 2 products and 2 quantities.
  4. Click on a product line item on the order.
  • It should highlight.
  • The Reduce Stock and Increase Stock buttons should slide down.
  1. Click on it again.
  • It should unhighlight.
  1. Click on a product line item on the order again.
  2. Click the edit pencil.
  • The Reduce Stock and Increase Stock buttons should slide up.
  1. Click Cancel or Save.
  2. Click on a product line item on the order again.
  3. Click Reduce Stock.
  • On refresh an order note should be added indicating the product stock was reduced by the line item quantity.
  1. On the same item, increase the quantity of the item and save.
  2. Reduce the stock on that item again.
  • On refresh an order note should be added indicating the product stock was reduced by the net change in the line item quantity.
  1. Increase the stock on that item.
  • Order note indicating the full quantity reduced should be added back to stock.
  1. Reduce stock on all product line items. Order notes should reflect those changes.
  2. Increase stock should also calculate net adjustments and limit stock increases to the amount reduced.

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 ran tests with your changes locally?

Additional note/question for reviewer: In restoring the tbody tr.selected CSS, I did not restore the td pointer in https://github.com/woocommerce/woocommerce/blob/3.4.7/assets/css/admin.scss#L1454:L1456. If that should be restored as well, let me know.

Changelog entry

Add manual item stock adjustment in order edit

$reduced = $order_item->get_meta( '_reduced_stock', true );
if ( ! $reduced ) {
$reduced = $net_stock_change;
} elseif ( $net_stock_change <= $reduced ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why so much whitespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'm not sure why phpcs didn't catch that one.

@claudiulodro
Copy link
Contributor

Thanks for your work on reimplementing this feature. The admin UI part of everything looks good in my testing.

I wasn't able to get the increase/reduce stock buttons to do anything, though. Looking at the code in this PR there doesn't seem to be anything hooked to the buttons that will call the ajax methods?

Also requesting a review from @mikejolley since he will be back by the time 3.5.3 is released.

@claudiulodro claudiulodro added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: approved labels Dec 11, 2018
@rrennick
Copy link
Contributor Author

Looking at the code in this PR there doesn't seem to be anything hooked to the buttons that will call the ajax methods?

This has been added.

@mikejolley mikejolley added status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jan 3, 2019
@mikejolley mikejolley removed this from the 3.5.4 milestone Jan 3, 2019
@rrennick rrennick closed this Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: blocked The issue is blocked from progressing, waiting for another piece of work to be done.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants