基于运输目的地的 Magento 税率

Magento Tax Rate Based on Shipping Destination

如何在结账时更改送货目的地时更改税率?

我没有在后端找到相关设置(如果我错了请更正)所以我想我必须用自己的模块来解决这个问题。

我从哪里开始那个项目?

示例目标:

有什么想法,类 和方法必须为此改变吗?

提前致谢。

我完成了我的任务。

我覆盖了 Mage_Tax_Model_Calculation 方法 getRateRequest。 在这里,我可以在使用 $basedOn 分配 $address.

的 switch 语句之前添加自己的逻辑
    //override basedOn
    $basedOn = 'billing';
    if ($shippingAddress != null && $billingAddress != null) {
        if ($shippingAddress->getData('country_id') != $billingAddress->getData('country_id') && $shippingAddress->getData('country_id') == 'DE') {
            $basedOn = 'shipping';
        }
    }
    // needed to still work if one of both addresses is null
    if ($shippingAddress == null || $billingAddress == null) {
        $basedOn = 'default';
    }
    else  {
        $ship = $shippingAddress->getData('country_id');
        $bill = $billingAddress->getData('country_id');
        if(empty($ship) || empty($bill))  {
            $basedOn = 'default';
        }
    }