1

I have a method with create a shipping rate, but I need to add shipping tax on this specific rate, how can i do this? My class:

$method = $this->rateMethodFactory->create();
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData("title"));
$method->setMethod("ddr");
$method->setMethodTitle($response[0]['messages']['result']['service'] . " - " . " Delivery time " . $response[0]['messages']['result']['totalTransitDays'] . " day(s)");
$shippingCost = (float)$response[0]['messages']['result']['costFreight'];
$method->setPrice($shippingCost);
$method->setCost($shippingCost);

$result->append($method);

i have already tried this, but didn't works:

$method->setBaseShippingTaxAmount(8);
$method->setTaxAmount(8);

**

I need that if the customer chooses my specific rate, the tax that I choose appears. in the summary.

**

enter image description here

1

please chnage setting from admin instead of code.(Tax Class for Shipping = Taxable Goods)

enter image description here

mark solution if right for you.

3
  • Ok, but how can i add tax in my shipping rate? May 18 at 12:40
  • add shipping rate including tax "$method->setPrice($shippingCost);" May 19 at 3:16
  • But that way the tax will not be highlighted, I edited my question to better exemplify. May 19 at 19:11
0

You can try my method. I have uploaded my code to pastebin so you can easily read it: https://pastebin.com/5AgsE5eY

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.