Skip to main content
Question

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

  • September 11, 2022
  • 2 replies
  • 100 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}

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

2 replies

christina.d
Forum|alt.badge.img+9
  • Zapier Staff
  • September 12, 2022

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! 🤗


Satya09
Forum|alt.badge.img+7
  • Beginner
  • September 25, 2022

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