Question

Shopify order brought into Salesforce, with Zapier, but line item price is divided by quantity ordered in item price

  • 11 September 2022
  • 2 replies
  • 63 views

I have an active Zap that brings a Shopify order into salesforce, creates an opportunity and adds line items, found in pricebook, to the newly created opportunity.  The issue is that the item price brought into the opportunity is divided by the quantity of items ordered in shopify. Example, buy 4 units at $3.49 each on shopify - in salesforce it is entered as correct item but price is $.87 ($3.49/4). I want the items ordered in shopify store (quantity and price) to match in salesforce opportunity.  Here is the code i have, where i think the error may be: 

import re

string = input['string']

sku = re.findall('\[".*?",\s".*?",\s"(.*?)",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?"\]', string) 

quantity = re.findall('\[".*?",\s".*?",\s".*?",\s"(.*?)",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?"\]', string) 

price = re.findall('\[".*?",\s".*?",\s".*?",\s".*?",\s"(.*?)",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?"\]', string) 

pricebookid = re.findall('\[".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s"(.*?)"]', string) 

itemid = re.findall('\[".*?",\s".*?",\s".*?",\s".*?",\s"(.*?)",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?",\s".*?"\]', string) 

return {'sku': sku, 'quantity': quantity, 'price': price, 'pricebookid': pricebookid, 'itemid': itemid}


2 replies

Userlevel 7
Badge +9

Hey there, @afenos!

I hope you don’t mind, I moved your question into the Code & Webhooks forum to see if we can get some more qualified eyes on your question! 👀

Thanks for reaching out in the Community! 🤗

Userlevel 4
Badge +6

Hello @afenos 

Did you try mapping the fields from the shopify trigger step to salesforce action instead of using a Code by Zapier Step?

Because that is one option through which you can directly map the data output from your Shopify Purchase Trigger

 

 

Reply