Easy-digital-downloads: 3.0 - Orders - Combine Items, Adjustments, and Amounts UI

Created on 12 Feb 2020  路  28Comments  路  Source: easydigitaldownloads/easy-digital-downloads

Enhancement Request

Explain your enhancement (please be detailed)

Create a unified UI to present Order Items, Adjustments, and Amounts.

Justification or use case

Currently when viewing or creating an order in EDD 3.0 there are 3 separate areas containing amounts related to the Order: Items, Adjustments, and Amounts.

As it stands the Items and Adjustments are implemented with WP_List_Table, separate from the Amounts area:

Screen Shot 2020-02-12 at 11 14 36 AM

The "Order Adjustments" area is likely causing the most disconnect in the UI. Grouping applied Discounts inside of "Order Adjustments" but then displaying "Adjustments" and "Discount" amounts separately in other areas causes confusion as to what an Adjustment actually is.

While the new database has provided tons of great new functionality I think the current UI presents the information too much in a _database-y_ way versus a more traditional invoice. The user does not need to know that we store or classify tax, credit, fee, or discount as an adjustment.

Another potentially confusing concept is adjusting or displaying a "Refunded" status for individual line items. To help further enforce the concept of "order amounts cannot change" not adjusting the line item will help show that in this order nothing has changed.

Screen Shot 2020-02-12 at 11 25 21 AM

The above prototype (amounts are not accurate) displays a way to potentially resolve these disconnects.

By not "classifying" adjustments but instead simply listing how they affect the Order subtotal the user has fewer dots to connect.

Beyond that "refunded" line items remain the same after a Refund has been issued and instead a new entry is added to the amount summary after the existing Order total is listed. This helps enforce that the current order has not changed -- but there is a new record that affects the net. The Net amount could be shown below as well.

The line-item Discount and Tax amounts were moved below the Download name as secondary information because having them in their own column disrupts the Discount and Tax total amounts in the summary area. They can be shown when hovering a row if the specific information is needed.

Clicking "Issue Refund" will work similarly to what is setup now: listing the available order items that can be "refunded". Ideally you should be able to create a refund for a specific item quantity as well as any additional fees.

Creating an Order would present a similar UI, with "Add" buttons replacing the Refund button at the bottom. They would trigger a modal similar to the Refund modal allowing options to be selected (and the ability to override amounts).


Some previous discussion in https://github.com/easydigitaldownloads/easy-digital-downloads/issues/7341

component-administration component-orders scope-ui type-improvement workflow-needs-lead-feedback

All 28 comments

I think the current UI presents the information too much in a database-y way versus a more traditional invoice. The user does not need to know that we store or classify tax, credit, fee, or discount as an adjustment.

:100:

Using a modal for adding items would allow that UI to be expressed a little more freely/clearly:

Screen Shot 2020-02-12 at 2 08 52 PM
Screen Shot 2020-02-12 at 2 09 16 PM

As well as keeping the base Add/View screens more consistent.

Bringing the PR discussion back here.

@nosegraze regarding pull/7599#issuecomment-592003274 -- how about something like this:

Screen Shot 2020-02-27 at 3 51 38 PM

This would appear when the tax rate has changed and there are existing Order Items. Clicking "Update Amounts" would recalculate taxes for Order Items that were added without manually entering amounts.

We also may consider differentiating Order Item rows that were manually adjusted so it's more obvious why they do not change.

@spencerfinnell I like that :+1:

@nosegraze Since an Order can only have one actual tax rate the process now would mean that if you:

  1. Add a Download
  2. Change the rate
  3. Dismiss the tax rate notice
  4. Add another Download

All other Downloads that weren't manually adjusted when initially adding will be adjusted a well -- essentially doing the same as if you _had_ clicked Update Amounts.

If that's the case then the only time the notice is really helpful is if you're just about to create the order, realize the taxes are all wrong, and make an adjustment. I think that is a valid time to show it but wonder if the side effect of it showing _during_ order creation might cause confusion.

@spencerfinnell

All other Downloads that weren't manually adjusted when initially adding will be adjusted a well

Not sure if I'm 100% clear on this. In the steps you listed, are you saying that download from step 1 would be adjusted with the new tax amount?

Not sure if I'm 100% clear on this. In the steps you listed, are you saying that download from step 1 would be adjusted with the new tax amount?

Yes.

If the Tax amount wasn't manually set (on the individual Order Item) when it was initially added then changing the rate and adding a new Download updates all existing Order Items based on the new percentage. That is done under the assumption that an order only supports one tax rate.

However, looking again now, if you make a purchase on the frontend checkout there is an Order Adjustment record generated that stores a tax rate percentage for each Order Item. I'm not sure that amount is actually used anywhere currently, but we could (and probably _should_) do the same thing when manually creating an order which would allow Order Item tax amounts to remain independent of each other.

Unrelated to the above... I've discovered an inconsistency with fees and total calculations.

I'm testing with the Discounts Pro add-on, which adds discounts as "fees" (adjustments).

release/3.0

Screenshot from 2020-03-04 13-37-39

Notice there's one adjustment record and total is $89.40.

issue/7582

Screenshot from 2020-03-04 13-37-58

There are now two fee entries and total is recorded as $64.90.

I'm wondering if it's because of this:

Screenshot from 2020-03-04 13-38-27

The discount is applied to the order and order_item. In this case both of the object_ids are 57. I tried to reproduce this a second time and couldn't, because that second time the order_item ID happened to be different:

Screenshot from 2020-03-04 13-41-26

Possibly missing an object_type = order somewhere?

@nosegraze Maybe, but I'm still not 100% sure about these Adjustments being generated. I'm going to see what you find in https://github.com/easydigitaldownloads/easy-digital-downloads/issues/7621 first before trying anything further with Order Item-specific tax rates or Order Item-specific fees.

Some adjustments related to ensuring tax rates are easy to use/understand in https://github.com/easydigitaldownloads/easy-digital-downloads/tree/issue/7582-tax-change

  • When adding a Download before a rate is set there is a more obvious notice:
    Screen Shot 2020-03-16 at 10 02 41 AM

  • Manually set amounts are noted via †
    Screen Shot 2020-03-16 at 10 03 00 AM

  • The tax rate change notice explicitly mentions automatic calculations:
    Screen Shot 2020-03-16 at 10 06 34 AM

I like that :+1:

Note: removing an item doesn't appear to work for me. Clicking the x doesn't do anything. No console errors.

Correction: clicking the x does not remove the item from the table, but it does change the Total at the bottom to $0.00.

@ashleyfae Thanks -- I've noticed that before and wasn't sure if it was just a fluke or not. I'll figure that out.

7599 has been updated to address previous feedback.

Any remaining mobile issues should not be specific to this implementation and happen at a core/WordPress-level.

  • Confirmed inconsistent fee/totals issue has been fixed.
  • Confirmed issue with removing a download has been fixed.
  • Confirmed I can now add a download, then set a customer, then set a tax rate, then use provided button to update tax rate for existing downloads.
  • Confirmed responsive design works.

There is an issue with discount codes and tax calculations.

  • Create a new order.
  • Assign a customer / country that has a tax rate.
  • Add a download. Tax amount is calculated correctly.
  • Add a discount.
  • Tax rate is not reduced / recalculated.

Here's how it looks:

Screenshot from 2020-03-19 15-03-11

Here's what it should be:

Screenshot from 2020-03-19 15-03-23

In the admin UI the tax amount is the _pre-discount tax amount_ but it should be recalculated to take the discount into account.

@ashleyfae Updated #7599

@spencerfinnell Looking good now!

I have encountered one issue but it's sporadic and I don't know how to tell you to reproduce it. Sometimes when I'm adding a download, clicking Add Download doesn't do anything, so then I click it again, and it works but adds the download _twice_ (so I guess it did actually work the first time, the UI just didn't tell me it had?). I had it happen 3 times while messing around just now, but I couldn't _make_ it happen intentionally. :woman_shrugging:

@ashleyfae thanks for testing! I鈥檒l try to reproduce that. I still want to try and preload some Downloads in the modal too.

@ashleyfae Pushed some error handling that should prevent any of those weird situations from happening and includes recent Downloads in the list.

@spencerfinnell Excellent! I played around a bunch and the problem didn't happen again. I love the loading of products. :+1: There is one minor quirk... It doesn't impact functionality, just looks a bit weird.

  • Add one product to the order.
  • Add a second product. Keep an eye on the "Download" dropdown as you press the Add Download button.
  • You'll see the dropdown, like, quickly cycle through all the downloads that are already on the order. The more downloads you have in the order, the more noticeable it is.

Good catch. Pushed a few tweaks to stop that.

Don't think I can break anything else! Well done @spencerfinnell .

When adding a new order @spencerfinnell I'm seeing a weird date as the default:
image

Currently I'm on GMT +0

@spencerfinnell got it, merged that into release/3.0 and then updated both this issue branch and the try/edd3-orders

At this point, I'm starting to think we should just merge this whole thing into release/3.0 and we can follow up with anything needed there. I can't find anything breaking at this point, but there are a lot of things that this introduces that might be blocking going forward. It will clear out our issue list for the 3.0 milestone quite a bit and allow us to move forward, focusing on things that needed to be wrapped up.

thoughts @ashleyfae and @spencerfinnell ?

Fine by me! It will be easier to review any follow up issues in smaller PRs.

Yes, let's do it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JeroenSormani picture JeroenSormani  路  5Comments

davidsherlock picture davidsherlock  路  4Comments

scottbuscemi picture scottbuscemi  路  5Comments

zackkatz picture zackkatz  路  5Comments

zackkatz picture zackkatz  路  4Comments