Developer forum

Forum » Integration » Live Integration and custom Shipping Provider

Live Integration and custom Shipping Provider

Lars Bo Wassini Dynamicweb Employee
Lars Bo Wassini
Reply

I have a customer where the shipping options are dependent on the items in the cart. This means that even though the the shipping fee is calculated by the ERP (BC), we have created a shipping provider to let the user have access to the different delivery methods.

When a cart is going through the checkout process, we send the cart to BC using the custom shipping provider. BC then returns a list of shipping options including the fee and we shows this to the customer, who then selects the wanted shipping provider. This provider is then sent to BC with the order.

The problem is now that when we set the Live Integration option "ERP controls discoint calculations" our custom shipping provider is never called, BUT if we disable it, a standard shipping line is added to the order using the Live Integration/Code Unit. Is there a way to prevent the Live Integration from creating the additional order line?


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
if you want to disable the creation of the shipping order line from the Codeunit then you need to set the option "ERP controls shipping" to true.
BR, Dmitrij

 
Lars Bo Wassini Dynamicweb Employee
Lars Bo Wassini
Reply

But then the custom shipping provider is never called. It seems that the check also disables our custom code.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

That should not happen but if it doesn't work then you can try this approach:
1) Subscribe to OnBeforeGenerateOrderXml:
settings.ErpControlsShipping = true; // This will prevent addition of the shipping order line in the response
2) Subscribe to OnAfterGenerateOrderXml:
settings.ErpControlsShipping = false; // Restore changed value back so custom provider is called

Votes for this answer: 1
 
Lars Bo Wassini Dynamicweb Employee
Lars Bo Wassini
Reply

Thanks.

We have changed from a custom shipping provider to a subscriber.

 

You must be logged in to post in the forum