title: Need help to store variant data in shopify using "Shopify API Node.js"
body: <p>Hi recently I am working with reactjs &amp; nodejs project and developing a new dashboard module like this.</p>
  <p><a href="https://i.stack.imgur.com/jszKq.png" rel="nofollow noreferrer">ERROR SCREEN-SHOT</a></p>
  <p>now i want to add a product to Shopify but i will send data using API for variant but by default, it saves default Shopify data like this.</p>
  <p>[enter image description here][2]</p>
  <p>And here is my code </p>
  <ol>
  <li><p>Main Function On Submit click</p>
  <pre><code>const productAddEditSubmit = () =&gt; {
  
   var productObject = {
       name: fullProductData.name,
       description: fullProductData.description,
       category_id: fullProductData.category_id,
       certification_type_id: fullProductData.certification_type_id,
       artwork_origin_id: fullProductData.artwork_origin_id,
       price: fullProductData.price,
       currency: fullProductData.currency,
       quantity: fullProductData.quantity,
       sku: fullProductData.sku,
       status: fullProductData.status,
       purchase_url: fullProductData.purchase_url,
       // user_id: user._id,
       update_date: new Date(),
   }
  
   if (productActionValue.hasOwnProperty('id')) {
       // dispatch(updateProduct(fullProductData._id, productObject, tempMediaList))
   }
   else {
       dispatch(addProductData(productObject));
   }
   }
  </code></pre>
  </li>
  <li><p>Action File</p>
  <pre><code> export const addProductData = (product) =&gt; dispatch =&gt; {
   axios.post('/api/shopifyProduct', product).then((res) =&gt; {
   dispatch({
       type: ADD_PRODUCT,
       payload: res.data
   })
   })
   }
  </code></pre>
  </li>
  </ol>
  <p>[Final Data Sent to Shopify DB Using shopify-api-node <em>NPM Package</em>][5]</p>
  <ol start="3">
  <li><p>Post Route</p>
  <pre><code> router.post('/', (req, res) =&gt; {
  
   const getProductDataFromFrontEndPartOne = {
   title: req.body.name,
   body_html: req.body.description,
   product_type: req.body.category_id,
   status: &quot;draft&quot;
   }
  
   // getProductDataFromFrontEndPartOne this object data store in shopify
   shopify.product.create(getProductDataFromFrontEndPartOne)
   .then((res) =&gt; {
  
   // after res i did not store this object (getProductDataFromFrontEndPartTwo) into shopify.
  
       const getProductDataFromFrontEndPartTwo = {
           id: res.id,
           price: req.body.price,
           sku: req.body.sku,
           inventory_quantity: req.body.quantity
       }
       shopify.productVariant.create(getProductDataFromFrontEndPartTwo)
   })
   .catch(err =&gt; res.status(404).json({ success: false }));
   });
  </code></pre>
  </li>
  </ol>
  <p><em>Shopify.product.create</em> using this function to save data in Shopify if res is successful after I did send variant data into their particular product using res.id.</p>