Mapping Shopify Discounts to Odoo with Custom Calculations

Created by Aleksandra Furundzic, Modified on Tue, 29 Oct at 10:13 AM by Aleksandra Furundzic

For businesses using Shopify for eCommerce and Odoo as an ERP system, mapping discount values can be a common challenge—Shopify records discounts in dollar amounts, while Odoo requires them as percentages. 


By using SyncSpider's custom field functionality, you can configure your Shopify order imports to Odoo to automatically convert discount amounts into percentages so you discount data always displays correctly in Odoo.


This guide will walk you through the process of creating a custom calculated field in SyncSpider to automate the export of discount values from Shopify to Odoo.





TABLE OF CONTENTS






Steps to Create the Custom Calculated Field



Step 1: Create a New Task in SyncSpider 


Start by creating a new task in SyncSpider.  


Select  Shopify as the Source integration and choose Orders as the source entity. 


Select Odoo as the Target integration and choose Sale Order as the target entity.


Select Shopify Orders as source and Odoo Sale Order as target in SyncSpider.





Step 2: Configure Source and Target Settings

 

Set up the source and target settings based on your specific data requirements. 





Step 3: Add a Custom Calculated Field


In the Mapping step, locate CUSTOM FIELDS on the left side of the mapping screen. 



Click the + button next to CUSTOM FIELDS to open the Custom Fields window and select 'Calculated Field.'


Select Calculated Field option in SyncSpider's Custom Fields menu.



Step 4: Configure the Calculated Field


In the Configure Calculated Field screen, set up the custom field with the following formula: 


(Items / Total Discount)/(Items / Price * Items / Quantity) *100 



 

Name:

Enter a name for your calculated field here. 


For this setup, you might use something descriptive like "Discount Percentage" to easily identify it in your mappings.


Build Expression:

This section is where you build the formula to calculate the discount percentage. 


You’ll use the following settings to construct the required formula: 


Field or Constant Value:

Select a field from the data source (e.g., Items / Total Discount or Items / Price) or input a constant value. This helps define the specific elements in your calculation.


Operator:

Choose mathematical operators like addition, subtraction, multiplication, or division. For calculating a percentage, division and multiplication operators are commonly used.


Result Modifier:

Apply modifiers if needed, such as rounding results or converting to a specific format. This is optional and can be helpful for fine-tuning the output.


Expression Preview:

As you build your formula, this preview box displays the full expression, allowing you to verify that the formula is set up correctly.


Once you’ve completed your formula and verified it in the Expression Preview, click Done to save your calculated field 




4.1 Understanding the Discount Formula


The discount formula used in SyncSpider converts Shopify’s dollar-based discount into the percentage format required by Odoo. It does this by dividing the total discount amount by the pre-discounted item price, factoring in the item quantity, and then multiplying by 100 to express it as a percentage. 


Specifically, the formula is structured as:


(Items / Total Discount)/(Items / Price * Items / Quantity) *100


This calculation takes the total discount applied to items and expresses it relative to the full item price and quantity, creating an accurate percentage that can be mapped to Odoo’s discount field. This formula ensures consistent discount data across both platforms, keeping your Shopify and Odoo systems in sync.



Step 5: Map the Calculated Field to the Target Field 


In the mapping schema under Order Lines, drag and drop the Discount Percentage custom calculated field you just created to correspond to the Discount (%) field in Odoo. 


This calculated field will now provide the correct discount percentage for each product, ready for export to Odoo. 


Discount Percentage custom field mapped to Odoo's Discount (%) field.



Once the mapping is complete, click 'Next', review the task settings, and trigger it to run as needed to export Shopify discounts as percentages in Odoo.



Additional Resources


For more information on Odoo or Shopify, check out the following resources: 



Odoo and Shopify are just some of the tools we support!


To check the list of the tools and features we support please click here!


If you don't see your favorite tool on our list, please take the time and send us the request here to create an integration for you or UP-vote if it's already on the list :) 


We develop integrations based on the requests and up-votes :) 


We hope that this covers everything. If you have any further questions or need additional clarification please reach out to us via [email protected] or our chat widget!

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article