-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin UI : bug when displaying the price of a variant from another channel #1392
Comments
The relevant code is here: vendure/packages/core/src/service/services/product-variant.service.ts Lines 431 to 440 in 0823ca7
Removing this line will most likely have unintended consequences, e.g. listing products in the default channel will throw. Furthermore, the graphql I'm open to suggestions on how to better handle this in a non-breaking way. |
@michaelbromley would it be possible to have if you already made the assumption that a variant must have a price in a channel, it should not break, right ? Bonus : in the admin_ui, display N/A instead of Infinity 😄 I see that there is already a Additionally, an error should be thrown when addItemToOrder if variant.price == NO_PRICE WDYT ? |
also, to not break mono-currency setups, you could check the default channel currency is the same
|
Thanks for the suggestions! Well,
Can we back up a bit here and help me to understand your workflow. You are adding a product to a non-default channel first, and then want it to not have a price in the default channel. Do you plan to, at some future point, assign it a price in the default channel? Or do you wish it to remain "N/A"? |
Sure -1 is a hack (as well as any other int) In a more general way, my use case is to NOT allow orders/customers/products/anything in the default channel If I step back again in am ore general way, what I'd like is to restrict an administrator to some channels |
Ah ok. Now we are drilling down to the X in this XY problem! First thing: everything is always in the default channel. It is actually a parent of all other channels. Illustration here: https://www.vendure.io/docs/developer-guide/channels/ So in order to restrict admins so they cannot access the default channel, you would use the built-in role-based access control. When you create a role in the admin ui, you can limit it to specified channels: Then you'd create an administrator, and assign it that newly-created role. |
I'm going to test that, thanks for pointers ! |
Please be sure to update this thread if you managed to resolve the issue using the channel permissions approach 👍 |
Thanks for your detailed write-up and summary. I'll see how I can somehow communicate this better in the docs based on those use-cases you mentioned, so other people don't get confused by the behaviour. Regarding that "total orders" widget - yeah that's probably just an impossible problem to solve - displaying the order totals from all channels, possibly with several different currencies, in a single number! If I were the super admin of a multi channel, multi-currency setup, I'd probably want a widget which summarizes order totals in each channel or something like that. Anyway, luckily that is all configurable and people can build whatever widgets they need. |
Added this section to the Channels docs: https://www.vendure.io/docs/developer-guide/channels/#channels-currencies--prices |
@michaelbromley that seems clear to me (at least now that I am very familiar with this stuff :) if I may just add that you should also update https://www.vendure.io/docs/developer-guide/multi-tenant/ with a link to https://www.vendure.io/docs/developer-guide/channels/#use-case-multiple-separate-shops Something like : Take extra care if you log in with a super admin in the default channel, especially with prices and currencies. See more details at developer-guide/channels and especially in #use-case-multiple-separate-shops |
Describe the bug
Slack thread.
To Reproduce
Expected behavior
Because the prices of a variant are per channel, we should see N/A (or anything else) to indicate that this variant has no price in the current channel
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: