Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lesley 107 posts 349 karma points
    Feb 12, 2021 @ 03:18
    Lesley
    0

    Access order details in shipping calculator

    Is there any way to access order details from within a custom shipping calculator?

    Our client charges shipping at $x flat rate + $y per item for overseas postage, so we need to be able to determine how many items are in the order.

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Feb 12, 2021 @ 08:54
    Nik
    101

    Hi Lesley,

    Yes there is, I do a similar thing as shipping for a site I built is based upon the delivery country

    In your custom calculator you will have an overridden method called CalculateShippingMethodPrice. One of the parameters of this is ShippingCalculatorContext context

    This context has access to the order via the Order property;

    context.Order
    

    This should allow you to access your order to identify the number of items on it.

    Cheers

    Nik

  • Lesley 107 posts 349 karma points
    Feb 14, 2021 @ 18:49
    Lesley
    0

    Thanks Nik,

    Worked perfectly..

Please Sign in or register to post replies

Write your reply to:

Draft