WooCommerce line item discounts to Zoho Books invoices

Status: Closed · Asked by nicole watt on · 0 views

nicole watt — Question ·

Hello team! I have a workflow set up that creates a Zoho Books Invoice (multi-line) from WooCommerce orders. I am using the Data Transformer to break out the line items, which is working great!

The problem I'm running into is adding discounts to the line items. WooCommerce does not have a line item discount field, only the total order discount. To get the line item discount, you have to subtract the Line Item Total from the Line Item Subtotal (see screenshot).

When I try to do this by creating a SUBTRACT funtion in the Number Formatter, it does not work properly because it is seeing all of the comma separated values..

How can I extract the data to create a Line Item Discount?

Thanks for your help!

Attachments

Screenshot 2023-04-10 171306.jpg
Pabblymember11 — Reply ·
The problem I'm running into is adding discounts to the line items. WooCommerce does not have a line item discount field, only the total order discount. To get the line item discount, you have to subtract the Line Item Total from the Line Item Subtotal (see screenshot).

Regarding your concern about the line item for a discount price, we have added a JavaScript code in the workflow to calculate the individual products' discounts.

Kindly try it and let us know if that works for you.

nicole watt — Reply ·

It seems to be headed the right direction, however, the result needs to end up in an array so it can apply to the subsequent line items. It should be more like 4. Output : 0,5 and allow for infinite values based on the number of line items in the order.

Attachments

Screenshot 2023-04-11 095043.jpg
Pabblymember11 — Reply ·

Hey @nicole watt

Please check your workflow once we have parsed the discount line item from the JavaScript Code to Text Formatter and after parsing the line item discount.

I hope this might help you out.

nicole watt — Reply ·

YES!!! Oh, that's wonderful! It works perfectly. I tried it with 4 items and multiple discounts, and the results came out as expected. Thank you so much for your help!

Back to all forum threads · Log in to reply