lunar
lunar copied to clipboard
TaxDriver and Shipping Prices
Discussed in https://github.com/getcandy/getcandy/discussions/234
Originally posted by ryanmitchell March 22, 2022 I have a custom tax driver (to interact with Avatax) and am trying to work out how to apply the tax returned to the shipping price (which itself comes from a 3rd party ShipEngine).
So my tax driver returns a getBreakdown()
for each of the line items - perfect - all working well. I simply match the line id to the one I passed to Avatax and thats my tax value.
But I've no way of either adding an ad-hoc breakdown for shipping, or for applying a breakdown to the shipping option selected. Instead I have to pass a \GetCandy\Models\TaxClass
, which is database driven, and therefore wouldnt scale (I would have to create a new model for every tax value Avatax returns for shipping).
I think this could be resolved by applying the tax driver to the GetCandy\DataTypes\ShippingOption
, rather than passing a taxClass? But this would mean modifying the tax driver methods, as it expects a purchasable.
Is this something you'd consider attempting a PR for @ryanmitchell ?
Yeah I’ll take a look at it and see how I get on
Ive actually taken a second look at it and I think I can work with things as they stand.
In my TaxDriver getBreakdown
I can check for whether the purchasable is an instanceof \GetCandy\DataTypes\ShippingOption
and if so apply some logic to add tax for shipping.
@ryanmitchell should we close this issue now?
Yep!