There are atleast two viable way to do it and it depends a bit on which other integrations you have and how that fee is based on the total weight:
In either case extra work have to be taken to keep the fee updated whenever the total weight changes.
I don't know why it "requires some work to exclude the lineitem from promotions.", it should be super easy and simple as
entryFilterSettings is an instance of EntryFilterSettings which can be retrieved by constructor injection
Correct, slipped my mind, it is what i get for doing things on friday afternoon. :)
entryFilterSettings.AddFilter<Co2CompensationVariationContent>(x => false);
Would definately do the job, more info and full example here: https://world.episerver.com/documentation/developer-guides/commerce/marketing/exclude-products-from-promotions/
The extra work with having it as a lineitem will have more to do with how that lineitem will be displayed on the site as it probably shouldn't look like a normal lineitem.
I am going to implment a Co2 compensation fee feature in a Episerver Commerce project.
In checkout page, customer can choose to pay a optinal Co2 compensation fee based on the total weight of the products.
If the customer choose to pay this fee, it needs to be a part of the total cost in purchase order.
What is the best way to implment this feature? Any suggestions?