Updating customer order data that comes out of Shopify before sending it to Xero

Hi all,

I have a question about modifying customer order data that we extract from Shopify orders before sending to a Purchase order in Xero.

The issue I’m having is this…


Some information has been blanked out in yellow for customer privacy

Some of our Shopify orders originate in eBay and are imported into Shopify via an integration.
This integration communicates some information with Shopify that we want to remove before sending to a Xero purchase order. This information is as follows:

  • The eBay-Shopify integration places the eBay username in the Shopify “Shipping Address Last name” field. You’ll see it in brackets in the above screenshot (jonesmal). We want to remove this before sending the “Shipping Address Last name” field data to Xero. I’m wondering if there’s a way we can do a find and replace or similar to tell Make to look at the “Shipping Address Last name” field and if it includes an opening bracket “(” then remove the bracket and everything after it.
  • The eBay-Shopify integration also places an eBay unique code on one of the address lines — in the screenshot you’ll see this as ebayq24dvx6. As per the above, I’m wondering if we can tell Make to strip out any text from the address field that starts “ebay”

Any advice would be greatly appreciated!

Thank you
Duncan

Hi Duncan, yes thats easily possible! You will probably have to play around a bit with the different string functions to get the result right 100% of the time.

https://www.make.com/en/help/functions/string-functions

You are most likely going to need some nested if, contains and replace functions. Another way would be the “Replace” module from Text Parser and using a regular expression.

How good are you with these functions? Looks like a great use case to learn a new skill :stuck_out_tongue:

1 Like

Got it! Did some googling on regex and figured it out.

Managed to remove the eBay code “ebayq24dvx6” using this:

{{replace(5.shipping_address.address2; “/(EBAY|ebay)+[A-Za-z0-9]+/g”; ) }}

and removed the eBay username in brackets from the last name field using this:

{{replace(5.shipping_address.last_name; “/(.*)/g”; ) }}

This tool is really handy for building regex: https://regex-generator.olafneumann.org
And this tool is really handy for testing: https://regexr.com/

1 Like