Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:02:34+00:00 2026-06-14T22:02:34+00:00

I am using webhook to update my MS sql server when order creation and

  • 0

I am using webhook to update my MS sql server when order creation and the below is the xml i got it from shopify webhook

<?xml version="1.0" encoding="UTF-8"?>
<order>
  <buyer-accepts-marketing type="boolean">true</buyer-accepts-marketing>
  <closed-at type="datetime" nil="true"></closed-at>
  <currency>USD</currency>
  <email>jon@doe.ca</email>
  <financial-status>voided</financial-status>
  <fulfillment-status>pending</fulfillment-status>
  <gateway>bogus</gateway>
  <id type="integer">123456</id>
  <name>#9999</name>
  <note nil="true"></note>
  <number type="integer">234</number>
  <subtotal-price type="decimal">229.94</subtotal-price>
  <taxes-included type="boolean">false</taxes-included>
  <total-discounts type="decimal">0.0</total-discounts>
  <total-line-items-price type="decimal">229.94</total-line-items-price>
  <total-price type="decimal">239.94</total-price>
  <total-price-usd type="decimal" nil="true"></total-price-usd>
  <total-tax type="decimal">0.0</total-tax>
  <total-weight type="integer">0</total-weight>
  <updated-at type="datetime">2012-11-23T12:34:25-05:00</updated-at>
  <created-at type="datetime">2012-11-23T12:34:25-05:00</created-at>
  <token nil="true"></token>
  <landing-site nil="true"></landing-site>
  <referring-site nil="true"></referring-site>
  <cancelled-at type="datetime">2012-11-23T12:34:25-05:00</cancelled-at>
  <cancel-reason>customer</cancel-reason>
  <cart-token nil="true"></cart-token>
  <browser-ip nil="true"></browser-ip>
  <landing-site-ref nil="true"></landing-site-ref>
  <order-number type="integer">1234</order-number>
  <discount-codes type="array"/>
  <note-attributes type="array">
  </note-attributes>
  <processing-method nil="true"></processing-method>
  <line-items type="array">
    <line-item>
      <requires-shipping type="boolean">true</requires-shipping>
      <fulfillment-service>manual</fulfillment-service>
      <grams type="integer">5000</grams>
      <price type="decimal">199.99</price>
      <quantity type="integer">1</quantity>
      <sku>SKU2006-001</sku>
      <title>Sledgehammer</title>
      <product-id type="integer" nil="true"></product-id>
      <variant-id type="integer" nil="true"></variant-id>
      <vendor nil="true"></vendor>
      <variant-title nil="true"></variant-title>
      <fulfillment-status nil="true"></fulfillment-status>
      <name>Sledgehammer</name>
      <variant-inventory-management nil="true"></variant-inventory-management>
      <properties type="array">
      </properties>
    </line-item>
    <line-item>
      <requires-shipping type="boolean">true</requires-shipping>
      <fulfillment-service>manual</fulfillment-service>
      <grams type="integer">500</grams>
      <price type="decimal">29.95</price>
      <quantity type="integer">1</quantity>
      <sku>SKU2006-020</sku>
      <title>Wire Cutter</title>
      <product-id type="integer" nil="true"></product-id>
      <variant-id type="integer" nil="true"></variant-id>
      <vendor nil="true"></vendor>
      <variant-title nil="true"></variant-title>
      <fulfillment-status nil="true"></fulfillment-status>
      <name>Wire Cutter</name>
      <variant-inventory-management nil="true"></variant-inventory-management>
      <properties type="array">
      </properties>
    </line-item>
  </line-items>
  <shipping-lines type="array">
    <shipping-line>
      <title>Generic Shipping</title>
      <code nil="true"></code>
      <price type="decimal">10.0</price>
      <source>shopify</source>
    </shipping-line>
  </shipping-lines>
  <tax-lines type="array"/>
  <billing-address>
    <first-name>Bob</first-name>
    <last-name>Biller</last-name>
    <address1>123 Billing Street</address1>
    <address2 nil="true"></address2>
    <city>Billtown</city>
    <company>My Company</company>
    <country>United States</country>
    <phone>555-555-BILL</phone>
    <province>Kentucky</province>
    <zip>K2P0B0</zip>
    <latitude type="decimal" nil="true"></latitude>
    <longitude type="decimal" nil="true"></longitude>
    <name>Bob Biller</name>
    <country-code>US</country-code>
    <province-code>KY</province-code>
  </billing-address>
  <shipping-address>
    <first-name>Steve</first-name>
    <last-name>Shipper</last-name>
    <address1>123 Shipping Street</address1>
    <address2 nil="true"></address2>
    <city>Shippington</city>
    <company>Shipping Company</company>
    <country>United States</country>
    <phone>555-555-SHIP</phone>
    <province>Kentucky</province>
    <zip>K2P0S0</zip>
    <latitude type="decimal" nil="true"></latitude>
    <longitude type="decimal" nil="true"></longitude>
    <name>Steve Shipper</name>
    <country-code>US</country-code>
    <province-code>KY</province-code>
  </shipping-address>
  <fulfillments type="array"/>
  <customer>
    <email>john@test.com</email>
    <accepts-marketing type="boolean" nil="true"></accepts-marketing>
    <first-name>John</first-name>
    <last-name>Smith</last-name>
    <orders-count type="integer">0</orders-count>
    <total-spent type="decimal">0.0</total-spent>
    <note nil="true"></note>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime" nil="true"></updated-at>
    <state>disabled</state>
    <last-order-id type="integer" nil="true"></last-order-id>
    <tags></tags>
    <last-order-name nil="true"></last-order-name>
  </customer>
</order>

and the below is the php script i am using to get the data (XML parser)

$xmlString = file_get_contents('php://input');
$dom = new DomDocument();
$dom->loadXML($xmlString);
$itemList = $dom->getElementsByTagName('line-item');

foreach($itemList as $item) {

$qty='';
$sku='';

foreach($item->childNodes as $child) {

        if ($child->localName == 'quantity') {
      $qty = $child->textContent;
    }
    if ($child->localName == 'sku') {
      $sku = $child->textContent;
    }
}

so as you can see i can use the data in “line-item” such as “quantity”, “sku” node but then how can i use the data in “order” i mean like “total-price” node

sorry for making you confused if i did

Thank you so much in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:02:35+00:00Added an answer on June 14, 2026 at 10:02 pm

    From the first glance of your code.. you can access the total-price node by

    $order = $dom->getElementsByTagName('order');
    
    foreach($order as $get){
    
        foreach($get->childNodes as $child) {
            if ($child->localName == 'total-price') {
            var_dump($child->textContent); // this will get your total-price :)
            }
        }
    

    And by the way.. much better if your going to start in your order node.. 🙂 I hope i answered your question. I test it locally, so it should work.

    UPDATED:

    Much Easier from my post above.

    $order = $dom->getElementsByTagName('order');
    
    foreach($order as $get){
        $total = $get->getElementsByTagName( "total-price" );
        var_dump($total->item(0)->nodeValue);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using shopify webhook to update my sql server's 'qty' field when order
I am using shopify webhook to update my sql server's 'qty' field when order
Using SQL Server 2008 R2 we are looking for a way to select the
Using Microsoft SQL Server 2005, is there any way to see when a table
Using Tsql, how can I find out when MS SQL server was installed?
Using Java,I have to fetch multiple sets of values from an XML file to
Using SQL Server 2000 Table1 Id date --- ---------- 001 23/01/2012 002 25/01/2012 003
Using SQL Server 2005 Leave Table ID StartDate EndDate 001 02/03/2010 02/03/2010 002 02/03/2010
We discovered yesterday that when creating a Shopify webhook using the api, the specified
Using the NSXMLParser i can retrieve the data from the local XML file, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.