Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

OroTaxBundle

OroTaxBundle introduces tax-related features in the OroCommerce application.

The bundle enables back-office users to create taxes, configure tax types for products, customers, and jurisdictions, as well as setup tax application rules based on the tax types.

With the corresponding configuration of the bundle, customers can view applied taxes for orders and quotes.

The bundle also provides an interface that enables developers to implement integrations with additional third-party tax providers to the OroCommerce applications.

Create Custom Tax Provider

You can add your own custom tax logic with custom tax provider.

  1. Create tax provider that implements TaxProviderInterface interface:

 1<?php
 2
 3namespace Acme\Bundle\DemoBundle\Provider;
 4
 5use Oro\Bundle\TaxBundle\Provider\TaxProviderInterface;
 6
 7class DemoTaxProvider implements TaxProviderInterface
 8{
 9    const LABEL = 'acme.demo.providers.demo.label';
10
11    /**
12     * {@inheritdoc}
13     */
14    public function getLabel()
15    {
16        return self::LABEL;
17    }
18
19    /**
20     * {@inheritdoc}
21     */
22    public function isApplicable()
23    {
24        return true;
25    }
26
27    /**
28     * {@inheritdoc}
29     */
30    public function loadTax($object)
31    {
32        // implement your loadTax() method.
33    }
34
35    /**
36     * {@inheritdoc}
37     */
38    public function getTax($object)
39    {
40        // implement your getTax() method.
41    }
42
43    /**
44     * {@inheritdoc}
45     */
46    public function saveTax($object)
47    {
48        // implement your saveTax() method.
49    }
50
51    /**
52     * {@inheritdoc}
53     */
54    public function removeTax($object)
55    {
56        // implement your removeTax() method.
57    }
58}
  1. Register your own tax provider in the service container using the oro_tax.tax_provider tag with the alias attribute that contains a unique name of the tax provider:

1# src/Acme/Bundle/DemoBundle/Resources/config/services.yml
2
3services:
4    acme_demo.tax_provider.demo:
5        class: Acme\Bundle\DemoBundle\Provider\DemoTaxProvider
6        tags:
7            - { name: oro_tax.tax_provider, alias: demo, priority: 10 }
  1. Navigate to the admin panel under System > Configuration > Taxation > Tax Calculation and chose your own custom Tax Provider in the dropdown list.