OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Adding custom order totals?

This topic contains 4 replies, has 3 voices, and was last updated by  Andrey Yatsenko 3 years, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #38440


    I have a few additional fees to include to every order. They are: Handling fee, processing fee and shipping fee. I’m using setOverriddenShippingCostAmount on my Order object in order to set the custom shipping fee and it works great. However, I have no idea how to add custom fees. I’m able to easily add custom discounts, but not fees. What’s the proper way of doing this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #38451

    Andrey Yatsenko

    You can add a custom order subtotals, like taxes or shipping.

    It is required to create a subtotal provider, that implements SubtotalProviderInterface and register it at the container as a tagged service
    1) https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/TaxBundle/Provider/TaxSubtotalProvider.php#L13
    2) https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/TaxBundle/Resources/config/services.yml#L527-L536



    Hello – I have the same requirement for adding a % of the order total as “processing fee” to each order. I have looked into Andrey’s suggested code files, but am struggling to set started on this.

    Not sure if Vincent managed to implement Andrey’s suggestions and get it working – can someone please share some sample code to apply a custom processing fee (as % of the order value) and I can use it to implement my design?




    Hi Andrey – Can you please look at the code below and advise where I am going wrong or what have I missed?

    I have tried building a new bundle with the following folder structure:

    Below are the files:


    CustomServiceFeeBundle.php and bundles.yml simply have new bundle definition.


    Unfortunately, this is not working – not sure where I am going wrong. Can you please have a look and advise?



    Andrey Yatsenko

    Troubleshooting new bundle with the customization

    First, If you have an error, read the message, it usually contains an answer to what is wrong, if doesn’t help, try to google that message text.

    When you don’t have any errors follow the below steps:
    1) First, check that your bundle is loaded, it can be done with the built-in Symfony command

    If you are doing everything right on this step the bundle will appear in the list.

    Note: it is highly recommended to set the bundle priority to the high value so you will be able to override configuration from the previously loaded bundles.
    If doesn’t work, check https://oroinc.com/orocrm/doc/current/dev-guide/cookbook/how-to-create-new-bundle

    2) If you have registered the service, check that this service is loaded. Again there is a built-in Symfony command to do that

    where <service-name> is your service name (array key in a yaml configuration).
    If something is wrong in this step, check that the YAML file with defined service is loaded in Bundle Extension, like https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/TagBundle/DependencyInjection/OroTagExtension.php#L22-L26 and validate the syntax.
    If it doesn’t work, check the documentation https://symfony.com/doc/3.4/service_container.html

Viewing 4 replies - 1 through 4 (of 4 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top