Copied to clipboard

Flag this post as spam?

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


  • Lesley 105 posts 347 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 1413 posts 6212 karma points MVP 3x 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 105 posts 347 karma points
    Feb 14, 2021 @ 18:49
    Lesley
    0

    Thanks Nik,

    Worked perfectly..

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies