Developer forum

Forum » Development » Guidance on fees

Guidance on fees

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

What's the recommended approach to calculate a shipping fee? It seems I can choose between a FeeProvider and a ShippingProvider but I am not sure which one to choose.

My use case is relatively simple: based on the cart's contents, I need to call an external service, provide some data such as the addresses and the order line items and then I get a fee back. The configuration features of the ShippingProvider are nice, but I don't necessarily need them as I can easily configure that stuff elsewhere.

In addition to this: when does a FeeProvider show up? I created a custom class that returns a fixed value but that is never added to the cart. Is it overrules by a ShippingProvider?

Thanks in advance,

Imar


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Imar

You should probably use a ShippingProvider.

Each shipping method you have in your backend could have a ShippingProvider. If the selected shipping method on the cart returns a fee from a shippingprovider the fee calculation will stop there. If no fees are found, the feeprovider will be invoked - and if that returns a PriceRaw instance, the calculation will stop there.

Then if there is still no fee, the fee values from the fee method in the backend will be applied.

BR Nicolai

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

That's very helpful. I thought a Shipping method in the backend *was* a ShippingProvider. I now see that in order for the FeeProvider to be activated you need to have a method with its type set to None. Might be a good idea to add your answer to the documentation here: http://developer.dynamicweb.com/documentation/for-developers/ecommerce/extensibility/providers/fee-providers.aspx

Thanks!

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Speaking of that help link: it can't be found through search: http://developer.dynamicweb.com/search.aspx?q=The+FeeProvider+allows+you+to+manipulate+the+shipping+fee+of+an+order+in+eCommerce

Is that a configuration error?

Imar

 
Nicolai Høeg Pedersen
Reply

Glad I could clarify.

I've updated the documentation with this information!

BR Nicolai

 
Nicolai Høeg Pedersen
Reply

No reason why it cannot be found. Maybe because we have changed from developer.dynamicweb-cms.com to developer.dynamicweb.com...

 

You must be logged in to post in the forum