Question

How do I deduct taxes from Shopify product prices before applying the tax line rate in Zapier for Axonaut invoices?

  • 22 February 2024
  • 6 replies
  • 42 views

Hi there,

I’m having a problem with my zap between Shopify and Axonaut trying to create invoices in Axonaut when an order come through Shopify.

Products prices on my website are taxes included, so when they come through Zapier they are taxes included. As I need my tax line on invoice for accountability, I need to setup “Line items tax line rate” on zapier to have the taxes on the invoice. But then, it calculate twice the taxes on my invoice because it applied the tax line rate to the product prices that already include taxes.

So I want to deduct taxes of the products prices before it applies the tax line rate by Formatter in Zapier.

For that, I’m trying to do so :

But it always give me that trouble error :

 

I’ve tried few steps before the calculation, to convert in text, separate line items etc, nothing works, I’m out of ideas.

If anyone knows what to do,

Ask for further informations if needed,

Kind regards,

Justin


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @Justtttt1 

The 2 variables used in the Formula are structured as arrays, which is why the error is the happening.

 

You may have to use a Code step to iterate thru each array index and perform the math operation.

 

Try asking ChatGPT for help with the code.

Hi @Justtttt1 

The 2 variables used in the Formula are structured as arrays, which is why the error is the happening.

 

You may have to use a Code step to iterate thru each array index and perform the math operation.

 

Try asking ChatGPT for help with the code.

Hey,

Thanks for the answer, and do you know approximately how I should ask that ? I’m quite lost on “iterate thru each array index”. Thanks!

Userlevel 7
Badge +14

@Justtttt1 

 

For example, the screenshots shows 2 items in each array separated by commas.

e.g. You are trying to subtract 0-0, then 169.99-8.86, and so on for each pair.

The array index is the position of the item in the array, starting at 0 for the first array item.

 

@Justtttt1

 

For example, the screenshots shows 2 items in each array separated by commas.

e.g. You are trying to subtract 0-0, then 169.99-8.86, and so on for each pair.

The array index is the position of the item in the array, starting at 0 for the first array item.

 

Thanks for the answer, the AI doesn’t seem to understand what i want.. !

thanks!

@Justtttt1

 

For example, the screenshots shows 2 items in each array separated by commas.

e.g. You are trying to subtract 0-0, then 169.99-8.86, and so on for each pair.

The array index is the position of the item in the array, starting at 0 for the first array item.

 

Hi,

Made some progress here, but still not there yet (new problem!) : 

Made a javascript code that seems to work :

// Extracting the prices with taxes from the input data const pricesWithTaxes = inputData[ "This is my products prices with taxes" ].split(","); // Extracting the taxes from the input data const taxes = inputData["This is the taxes of the prices "].split(","); // Initializing an array to store the calculated prices without taxes let pricesWithoutTaxes = []; // Looping through the prices with taxes and taxes arrays for (let i = 0; i < pricesWithTaxes.length; i++) { // Converting the prices with taxes and taxes to numbers const priceWithTax = Number(pricesWithTaxes[i]); const tax = Number(taxes[i]); // Subtracting the tax from the price with tax to get the price without tax const priceWithoutTax = priceWithTax - tax; // Adding the calculated price without tax to the pricesWithoutTaxes array pricesWithoutTaxes.push(priceWithoutTax.toFixed(2)); } // Creating an output object with the prices without taxes output = { "Prices without taxes": pricesWithoutTaxes };

 

It generate my price without taxes super well : 

Setup like this in the next step :

But when setting up the creation of the invoice in the next step, it add up a weird total tax amount on each product :

That is showing like this on my invoice :

So that amount is showing at the product price place, but my VAT amount/invoice amount is right ! :

Any ideas ? I’m thinking maybe the format of the javascript results used in the next step is not right ?

 

Thanks a lot!

Userlevel 7
Badge +6

Hi @Justtttt1,

I took a look at your concern and it looks like you may have resolved this issue according to one of your tickets with our Support Team.

If you’re still having issues with this I’d recommend continuing the conversation with our Support Team via email.

Thanks!