openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.12k stars 724 forks source link

Producer/Supplier fees added to an OC are not displaying in the shop #10401

Closed tschumilas closed 1 year ago

tschumilas commented 1 year ago

Description

Producers who are suppliers to hubs are able to add an enterprise fee (created in the producer's enterprise profile) to their products being sold by a hub. This fee is different from a hub coordinator's fee. A hub coordinator can add an enterprise fee to an order cycle on the 'General Settings' page of the OC setup - and this fee will apply to ALL products coming into that OC. But in addition to, or instead of the coordinator fee - it has always been possible for a producer/supplier enterprise fee to be added to an OC. When a producer/supplier enterprise fee is added (on the incoming page of the OC), this fee applies to that producer's products only.

After this week's release, it does not seem possible to add a producer/supplier enterprise fee to an OC. (Unless missing something very obvious.)

Expected Behavior

A coordinator of an OC should be able to add a producer/supplier enterprise fee to the OC in the 'incoming' section.

Actual Behaviour

The order cycle can be setup, and the fee added to the OC - but it does not show in the shop price description, and the fee is not calculated upon purchase.

Steps to Reproduce

  1. Set up an OC with at least 1 supplier
  2. Set up a fee for that supplier in the supplier's profile (I tested with a per item fee - but haven't tested yet with other fee types)
  3. Open the shop - and see that the fee does not display in the product price in the shop.

Animated Gif/Screenshot

Workaround

I don't know any other way to add a supplier fee to an OC.

fee created in producer/supplier's profile: demo supplier enterprise fee set

fee entered into the incoming section of the hub's OC demo supplier enterprise fee added to oc incoming

Fee is not calculating on the price or showing in the shop store - supplier fee not showing in price breakdown

No fee calculated on an order placed in the shop order confirmation - no fee and no tax on fee

Severity

Your Environment

Possible Fix

tschumilas commented 1 year ago

sorry - double checked, and I don't see if I made a mistake. I just checked some order cycles with supplier/producer fees added that were set up before the last update and those fees are showing in the shop fine. So I think this happened with last release.

An s1? if there is no workaround?

filipefurtad0 commented 1 year ago

For supplier A and OC Coordinator / Distributor B:

Setting enterprise fees in the following way image

Adding the supplier fee to the OC:

image

Shows it in the shopfront:

image

Appears on the order edit page after checking out:

image

filipefurtad0 commented 1 year ago

However, if the the distributor adds it's own enterprise fee, in the OC outgoing exchange:

image

then it all looks like this:

Shopfront - notice only the distributor fee (OUTGOING) appears, but it includes the variant:

image

But it includes both percentages, applied over the product - 10% incoming + 10% outgoing. This can be seen in the order edit page:

image

RachL commented 1 year ago

@filipefurtad0 before pinging everyone I did a test on my own - but now I realized I I've tested a different scenario than yours and Theresa: I assumed the hub didn't have access to the producer profile. So I've added a hub fee in the incoming section on a particular producer. And it did not show up in the shopfront. Real life use case of this is if a hub needs to handle logisitics for a particular producer, they will want to add their own fee on top of the producer, not a producer fee.

Maybe there is a problem with fees and it works sometimes because the hub has permissions on the producer?

sigmundpetersen commented 1 year ago

Filipe I guess your last scenario is #9751 ?

filipefurtad0 commented 1 year ago

Thank you @sigmundpetersen - that's really good to know, so, no regression here :pray:

Real life use case of this is if a hub needs to handle logisitics for a particular producer, they will want to add their own fee on top of the producer, not a producer fee.

@RachL, great clarification. If I understand correctly, you mean:

Like this:

Incoming section image

And keeping the Outgoing section with no additional fees: image

In this case, I can still see the fee appearing in the shopfront: image

RachL commented 1 year ago

oh boy this is a tricky one. I can't reproduce anymore as well.

However I noticed that when I came back to my test, the fee was not showing up anymore in the OC.

Instead of it being a problem with the fees, could it be a problem with the saving of the OC?

@tschumilas can you still see the fees in the incoming section when you go edit the OC?

tschumilas commented 1 year ago

If I go to edit the OC - yes, I see the producer fee show up in incoming where i placed it. Further - in both incoming and outgoing I am able to add (I see in the dropdowns) all the possible producer and hub fees as set up in their respective profiles. So - I see all the options.

BUT - in my example above - the producer and hub enterprises are owned by the same user. (So it seems unlikely permissions matter if the same owner can't get the supplier fee to show - right?)

And the fee type (in case it matters) is flat rate (item).

I can do more testing of scenerios today if its helpful - let me know if there are particular configurations to look into.... We know this just happened yesterday with the latest release. A shop i set up just the day before is displaying fees fine.

tschumilas commented 1 year ago

And if its helpful -- I went into a hub that was setup - with a producer fee in incoming, and no coordinator fee at all - set up before the latest release - and the fees are calculating properly, displayed properly. I placed an order, and fees and taxes are all calcualted fine on my order.

filipefurtad0 commented 1 year ago

Thank you for those details Theresa. So I guess this means that we have an identical setup in production (one before, the other one after the release), and in one case all works, the other one does not. Do I understand this right?

Can you spot any differences on how the fees are set? For example:

I'll make some more tests and drop a line if I can reproduce it.

jibees commented 1 year ago

I tried to understand/reproduce the issue on my own, and I actually failed.

From fr-prod, it seems to work as attended, at least from the following configuration:

Capture d’écran 2023-02-09 à 14 58 40 Capture d’écran 2023-02-09 à 14 58 54 Capture d’écran 2023-02-09 à 14 58 33

Conclusion: it seems to append in specific configuration, and we need to spot the configuration that trigger the bug.

tschumilas commented 1 year ago

Strange thing - works now. Here's what I did:

originally - fee type was 'flat rate (item)', entered as producer fee - incoming - tax on fee was 'taxable' , tax on my test product was 'taxable' - that is the set up for my first issue report above - fees did not calculate in the shop.

I checked that just an hour ago - and fees were not calculating in the shop

Just now - I tried changing the tax category for the fee to 'inherit from product'

And - voila - the fee was calculated in the shop.

I changed the tax category for the fee back to 'taxable' and - the fee is calculated and showing in the shop.

I'm just going to purchase and see if the taxes on product and taxes on fee are calculating correctly...

tschumilas commented 1 year ago

Yes - fee is calculating in the shop, and taxes on the product and on the fee are calculating on my order.

What on earth?

tschumilas commented 1 year ago

I am no longer able to replicate this. I've tried different tax categories for the fee - and the producer fee, entered in incoming, is now consistently displaying in the shop price. But - I reallyl can't see what my error was in my original report. I double and triple checked the fee setup and the OC before I reported and after I reported.

RachL commented 1 year ago

The fact that I've experienced something similar makes me think we have something fishy here but we haven't nailed the way to reproduce it yet. I propose we keep a close eye on it in the coming days: keep fees in all our tests / use of the platform. And in the meantime we close here? We reopen when we have a new case of course.

tschumilas commented 1 year ago

ok (Incidently - the reason I even found this issue was because I was setting up a new OC to test the newly released producer tax report. It seems to me that taxes on producer enterprise fees are not showing in the report. (so taxes are underreported to the hub coordinator in that report) I just want to test that for different types of fee calculators - and will open an issue. It could be that we did not think producer enterprise taxes on fees ought to be in this report --- and then we just need to think about what report they ought to be in.....) Closing the current issue now.