Skip to content
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

Cost price on product variant entity #13250

Open
loevgaard opened this issue Oct 26, 2021 · 26 comments
Open

Cost price on product variant entity #13250

loevgaard opened this issue Oct 26, 2021 · 26 comments
Assignees
Labels
Feature New feature proposals. RFC Discussions about potential changes or new features.

Comments

@loevgaard
Copy link
Contributor

I would ❤️ to have cost price on the product variant. Would this be something you would be interested in if I create a PR?

@vvasiloi
Copy link
Contributor

I did that in combination with https://github.com/BabDev/supplier-plugin, so I have cost per supplier per variant.

@loevgaard
Copy link
Contributor Author

I also have the cost price plugin, but it's an overkill for just one property :D

I like the idea of having a cost price per supplier, but I would still vote for a simple cost price on the product variant because I believe that 90%+ of merchants will only have one supplier per item and hence one cost price.

@GSadee GSadee added the Feature New feature proposals. label Feb 1, 2022
@CoderMaggie
Copy link
Member

Hi! In 1.11 we have added the "Minimum Price" field on the Product Variant's channel pricing.
I believe it may be used as the cost price also. At Sylius we are not planning to add any other similar fields to the pricing at the moment.

Please reopen if you have any remarks 🖖🏻

@loevgaard
Copy link
Contributor Author

loevgaard commented Mar 7, 2022

Could you reopen this issue, Maggie? Minimum price has nothing to do with cost price. If you never want to add a cost price, then please don't reopen, but I think for such a simple field that maybe 90-95% shops will have on all their products, it is bad prioritization. At least I would love to hear the arguments against such a property.

@CoderMaggie CoderMaggie reopened this Mar 7, 2022
@CoderMaggie
Copy link
Member

Sure, reopened. 👌🏻 In my opinion "cost price" (as I understand it) can have a lot to do with "minimum price". But it all depends on the use-cases and these no one has mentioned in this issue yet.

Could you give some more context then?
Especially on what is this price used for?

Any examples from other platforms maybe?

@loevgaard
Copy link
Contributor Author

loevgaard commented Mar 7, 2022

The cost price is the price, the store owner pays for the product.

EXAMPLE

Black Jeans
Cost price: $10
Price: $20

Profit = Price - Cost price = $10

Other platforms
Shopify: https://shopify.dev/api/examples/product-cost

@vvasiloi
Copy link
Contributor

vvasiloi commented Mar 7, 2022

Just adding a property is a good start, but ideally it should also be used in the order processing.
Example from real project:

  • Each SKU has a cost (like purchasing or manufacturing price)
  • There are processing costs
  • There are shipping costs
  • There are order processors that calculate and save those costs (just like Sylius\Component\Core\OrderProcessing\OrderPricesRecalculator does with the product variant price)
  • There's a processor that calculates the profit based on order totals and the previously calculated costs and saves it on order
  • The profit can be shown on order, in dashboard (statistics chart), exported to a CRM or other external system, or sent to Google Analytics (or similar tools) instead of order total.

@CoderMaggie
Copy link
Member

CoderMaggie commented Mar 8, 2022

Okay, I would suggest making a plugin out of it. Like a ProfitsPlugin? That would not only have the cost price field but also a module to calculate and report the profits.

In my opinion, this is not something 70-90% of shops would use as it often happens in other systems.

Maybe a feature request to this plugin - https://github.com/odiseoteam/SyliusReportPlugin ?

@loevgaard
Copy link
Contributor Author

So what Victor is suggesting, Maggie, is a great idea, but as you can see it starts with the cost price on the variant ;)

Victor suggested I create PRs to Sylius instead of creating plugins all the time (not entirely what he said :D). Would you accept a PR for the cost price? :)

@Roshyo
Copy link
Contributor

Roshyo commented Mar 29, 2022

In my opinion, even if it would be nice to provide this costPrice in Core feature, it would make 0 sense without what Victor proposed as well. Just remember the originalPrice feature when it was not used anywhere (not even in templates).

But having those features in the core would be nice. I agree @CoderMaggie that not all the store would need that. But then thinking this way, you can remove a lot of features as well 😄

Having them on core would imo make sense, and would not be that hard to maintain. Sylius has to start implementing more of those features that not everyone use, but still a majority would.

@loevgaard
Copy link
Contributor Author

@Roshyo: It's a bold statement to say it makes 0 sense to have the cost price without anything else :D I, on the contrary, think it makes perfect sense 🎉

@loevgaard
Copy link
Contributor Author

Just want to put some arguments out there, so you can see what I mean. With only the cost price, it's possible to:

  • Enforce price rules on products (i.e. a product editor is not allowed to set the product price below a certain margin)
  • Do simple profit reports
  • Create inventory reports (i.e. what's our inventory worth in total costs)

If I used 10 more minutes I could probably think of three other things ;)

@vvasiloi
Copy link
Contributor

I agree with Stephane on this one. Adding just the property will have the same effects as the original price.
It will create confusion, a lot of questions on support channels, issues and PRs trying to make it work and at least 3 community plugins
I would either add at least a minimal foundation for using the property or not add anything at all.

@loevgaard
Copy link
Contributor Author

I suggested to Stephane that I could create a 'profit card' in the order show page in admin :)

@vvasiloi
Copy link
Contributor

That would be a good start. It will require some order processing logic, similar to how it's not done with original price.

@CoderMaggie
Copy link
Member

Enforce price rules on products (i.e. a product editor is not allowed to set the product price below a certain margin)

This ☝🏻 should be done based on the minimum price of a variant 😅


  • the profit report is a must for this field to be useful, I agree. We could maybe add it to the dashboard, wdyt?
  • binding it with the suppliers (which we also don't have, and it would totally make sense to wrap it in a plugin 😅) - for having a cost per supplier?
  • is this channel-agnostic? I mean is the cost price global or per channel?

@CoderMaggie CoderMaggie added the RFC Discussions about potential changes or new features. label Mar 30, 2022
@loevgaard
Copy link
Contributor Author

I would love to add this property along with the small report card on the order.

is this channel-agnostic? I mean is the cost price global or per channel?

Imo it should be channel agnostic. It should be on the product variant.

@elboletaire
Copy link

elboletaire commented Jun 30, 2022

Prestashop also supports this. In their case the variant field is increasing the base product price, but a lot of my clients use zero as product price, and then set that price increase to the real product's price.

I actually found this because I'm currently trying to convince some of my clients to migrate from prestashop to sylius, and this is a must for them (I guess I'll try to create a plugin in the meantime tho).

@loevgaard
Copy link
Contributor Author

I am thinking 1.12, @CoderMaggie, what are you thinking? 😉

@elboletaire
Copy link

Is this then planned for the upcoming 1.12? Or was just a thought? 😅

@vvasiloi
Copy link
Contributor

@elboletaire https://github.com/Setono/SyliusCostPricePlugin

@Rafikooo
Copy link
Contributor

Hi Folks, just FYI, we do not plan this feature for Sylius 1.12, we'll see what the future holds 💃

@loevgaard
Copy link
Contributor Author

Thank you for the update. Looking forward to 1.13 then ;)))

@nikkuexe
Copy link

Shopify handles 'cost' as part of 'inventory', which is separate from 'product' logic. Not all stores use their online shop to manage inventory, so it makes sense to have inventory be part of an optional module.

https://shopify.dev/api/admin-rest/2022-10/resources/inventoryitem
https://shopify.dev/api/admin-rest/2022-10/resources/product

@loevgaard
Copy link
Contributor Author

@nikkuexe: I see your point, but Sylius already has inventory in the core, i.e. not as a plugin :)

@nikkuexe
Copy link

@loevgaard For the scope of the discussion on cost, this is more similar to "inventory management" which is a function of a fulfillment center, not the online storefront.

Shopify gives a good explanation of this logic here: https://shopify.dev/api/admin-rest/2022-10/resources/inventorylevel

A product sold on a Sylius store could be fulfilled from one or more locations, and the cost per unit may be different at different locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature proposals. RFC Discussions about potential changes or new features.
Projects
None yet
Development

No branches or pull requests

8 participants