Copied to clipboard

Flag this post as spam?

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


  • seanrock 262 posts 483 karma points
    Jul 01, 2021 @ 06:59
    seanrock
    0

    ProductCalculator

    Hi Matt

    1 of these has a ProductCalculatorContext parameter, just wondering when that might be used. I'm implementing a 3rd party tax api and just wondering which one I should be overriding. Thanks

    public override TaxRate CalculateProductTaxRate(IProductSnapshot productSnapshot, TaxSource taxSource, TaxRate fallbackTaxRate,
            ProductCalculatorContext context)
        {
    
            return base.CalculateProductTaxRate(productSnapshot, taxSource, fallbackTaxRate, context);
        }
    
        public override TaxRate CalculateProductTaxRate(IProductSnapshot productSnapshot, TaxSource taxSource, TaxRate fallbackTaxRate)
        {
    
            return base.CalculateProductTaxRate(productSnapshot, taxSource, fallbackTaxRate);
        }
    
  • seanrock 262 posts 483 karma points
    Jul 01, 2021 @ 07:13
    seanrock
    0

    Actually a better question is, which Calculator should I be implementing. I'm only going to show tax during checked, after a delivery address has been choosen. I won't show tax per product or for shipping. The tax will be a total tax value based on the origin (of the store), customer delivery address, and product value, product quantity.

    I see that OrderCalculator doesn't have a method for calucating the tax for the entire order.

  • seanrock 262 posts 483 karma points
    Jul 02, 2021 @ 07:47
    seanrock
    0

    Actually origin/destination will vary from state to state.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 05, 2021 @ 14:11
    Matt Brailsford
    0

    Hey Sean

    You'll want to implement an OrderLineCalculator really. The ProductCalculator or more used for calculating the price of a product prior to adding it to an order. Once it's in an order, you'll want the OrderLineCalculator.

    RE which method to override, you'll want the one with the context arg.

Please Sign in or register to post replies

Write your reply to:

Draft