ERPNext does discounts on Grand Total while Shopify does them on Net Total

Any discounts on an order will sync totally wrong because all of the taxes will be calculated wrong. Then ERPNext uses this wrong total in all of the other documents, including the payments sync’d.

Order Net Total: $100
Discount: $20
Tax 10%

$100 - $20 = $80 (Discount on Net Total)
$80 * 1.10 = $88 (Tax Calculation)
Order total: $88

$100 * 1.10 = $110 (Tax Calculation)
$110 - $20 = $90 (Discount on Grand Total)

So everything in ERPNext is off. ERPNext even logs a payment of $90 instead of $88 which is what the customer actually paid.

So I have to then go in and cancel and amend any orders that have a discount on them, including changing all the payment information and sales invoices.

How to I make ERPNext do the discounts on Net Total instead of Grand Total?


Scott =)

1 Like

There is not enough information here to figure out what you are attempting to do.

However, it “appears” that you want the sales invoice to calculate the discount the same way that Shopify does when you use the Shopify interface with your ERPNext instance.

If this is the case, then you will likely need to change the “default” discount setting in the Sales Invoice document.

You can do this by going to Customize Form for Sales Invoice and selecting the correct field as shown in the screen shot below. This will allow you to change the default discount type from the “Grand Total” to the only other option available in this form, the “Net Total” and then save the form.

Then reload and try your transaction again to see if this helps.

In my example I an using ERPNext v13.11 so the row number may be different if you are using a different version.

Oh… and you should probably do this as at least a system manager or administrator.

As always…

Your mileage may vary! :sunglasses:



On the other hand…

If you are merely trying to get the total to work properly with the POS functions then you can change the discount setting in the offending POS profile accounting sections like the screenshot below:


I realized that I had not given enough information as I was going to sleep last night.

I am using ERPNext v13.16.1 with the latest ecommerce_integrations.

All I am trying to do is have orders, payments, and customers created in Shopify sync with ERPNext. We are using ERPNext to track our manufacturing and Shopify to sell our products.

I had changed the default in Sales Orders, but not Sales Invoices. I have updated the default in both, now. I will have to wait until another transaction in Shopify happens to verify it.

Thanks for your help. My apologies for not giving enough information.

One other quick question to make sure I am using the correct version of ecommerce integration, even after I installed the “ecommerce_integrations” app, I am still seeing the banner in the settings that says " Shopify Integration will be removed from ERPNext in Version 14. Please install Ecommerce Integrations app to continue using it." Am I using the wrong settings? They are the only Shopify integration settings that I have found.

I “believe” that you are already on the right track, although I cannot say for sure because I am not using any ecommerce integrations in my v13 sites yet.

The developer team has a tendency to either over alert you or under alert you to changes. The message you are seeing seems like one of the over alert scenarios. So I am thinking they are triggering on anything related to ecommerce to setup that message (even if you are already doing it right). As long as you are using the recommended application, then you should be good for the next version release.

As for the discount issue…

I think you have that solved now if you altered the default that I pointed out. Since there is no setting in the Ecommerce App for adjusting such transactions, the only thing I could think of to alter default behavior was the instructions above.

If it turns out to work, please come back to this thread and mark the post that lead to your solution as the solution so that others in the future may easily find the same answer.


This did not fix the problem. ERP next is still doing the discount on the Grand Total instead of the Net Total. I am thinking of filing a bug report.

Absolutely!! That would mean that the “Grand Total” may actually be hard-coded into the interface instead of using the ERPNext defaults.

I am not a developer and would not know where to look for such code, so I agree that a bug report with as much detail as possible should be generated. Be sure to include the fact that you already tried altering the default by changing the default setting in the “Customize Form” function.


Bug posted here:

Turns out it was a problem in my system. It was not using the add on code, it was using the code that came with ERPNext. Once I got it using the add on code everything is working properly.