Developer forum

Forum » Ecommerce - Standard features » Custom fees
Peter Leleulya
Reply

Is it possible to add custom fees and/or discounts to the cart from code?
I can't pre-define them in the CMS as a discount or a shipment fee because there are user specific value dependencies which i get realtime from an external system.
What I want is on each cart load/action to call a custom sub/void which determines if conditions are met and adds one or more fees (positive or negative value) to the cart (or update/removes them when they already exist). 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Peter

You can use a ShippingProvider or a FeeProvider.

  • ShippingProvider is used if you want a calucation for a specific shipping method - one provider (instance) for each shipping method created in management center. This type of provider is configurable.
  • FeeProvider is used if you want a generic calculation for all shipping methods.This type of provider is not configurable.

http://developer.dynamicweb.com/documentation/for-developers/ecommerce/extensibility/providers/fee-providers.aspx

Download sample ShippingProviders here: http://developer.dynamicweb.com/downloads/source-code.aspx

FeeProvider Docs: http://developer.dynamicweb.com/api8/#Dynamicweb~Dynamicweb.eCommerce.Orders.FeeProvider.html

BR Nicolai

 
Peter Leleulya
Reply

So it isnt possible to add multiple fees? (each with its own custom description)

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

You can add multiple discounts using a discount provider.

But only one shipping method and fee.

But you can have your ShippingProvider return "Text 1, Option 2, Condition 3 - 10+12+23" as a text and the sum of the amount as the fee it self. Otherwise you have to add them as orderlines using products.

Votes for this answer: 1
 
Peter Leleulya
Reply

OK, thanks for your info. I'll try to figure it out :)

 

You must be logged in to post in the forum