Sending Order Details From WooCommerce To External System Over API The 2019 Stack Overflow Developer Survey Results Are InCustomize woocommerce order detailsHow to get Customer details from Order in WooCommerce?Sending WooCommerce order to NetSuiteOrder Item details in woocommerceHow to get WooCommerce order detailsWooCommerce: Send order details with an HTTP POST requestwoocommerce variations order detailsWoocommerce Order Details ShortcodeSending Orders to Woocommerce API from External SiteExport order details from external system into Woocommerce (via Rest API possibly?)

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

How to save as into a customized destination on macOS?

How can I autofill dates in Excel excluding Sunday?

Geography at the pixel level

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Have you ever entered Singapore using a different passport or name?

Did 3000BC Egyptians use meteoric iron weapons?

Aging parents with no investments

Why do UK politicians seemingly ignore opinion polls on Brexit?

Is flight data recorder erased after every flight?

Are there incongruent pythagorean triangles with the same perimeter and same area?

What is the most effective way of iterating a std::vector and why?

One word riddle: Vowel in the middle

Deal with toxic manager when you can't quit

The difference between dialogue marks

Protecting Dualbooting Windows from dangerous code (like rm -rf)

Loose spokes after only a few rides

Multiply Two Integer Polynomials

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

Why isn't airport relocation done gradually?

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

Are spiders unable to hurt humans, especially very small spiders?

Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?

What do hard-Brexiteers want with respect to the Irish border?



Sending Order Details From WooCommerce To External System Over API



The 2019 Stack Overflow Developer Survey Results Are InCustomize woocommerce order detailsHow to get Customer details from Order in WooCommerce?Sending WooCommerce order to NetSuiteOrder Item details in woocommerceHow to get WooCommerce order detailsWooCommerce: Send order details with an HTTP POST requestwoocommerce variations order detailsWoocommerce Order Details ShortcodeSending Orders to Woocommerce API from External SiteExport order details from external system into Woocommerce (via Rest API possibly?)



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








4















I am trying to send woocommerce order to netsuite via an external api I have written. I am nw to woocommerce and do not fully get how to add this functionality.



I have added the following code to the functions.php file in public_html/wp-content/themes/reverie-master/



add_action( 'woocommerce_payment_complete'', 'wdm_send_order_to_ext'); 
function wdm_send_order_to_ext( $order_id )
// get order object and order details
$order = new WC_Order( $order_id );
$email = $order->billing_email;
$phone = $order->billing_phone;

//Create the data object
$orderData = array(
'customer_email' => $email,
'customer_phone' => $phone
);

$apiData = array(
'caller' => 'woocommerce',
'json' => $orderData,
'key' => 'MY_SECRET_KEY'
);

$jsonData =json_encode($orderData);

$url = "";
$api_mode = 'sandbox';
if($api_mode == 'sandbox')
// sandbox URL example
$url = "https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX_SB1&h=XXXXXXXXXXXXXXXX";

else
// production URL example
$url = "";


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($jsonData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec ($ch);

curl_close ($ch);

// the handle response
if (strpos($response,'ERROR') !== false)
print_r($response);
else
// success




I have tested the brunt of this code, just the parts that do not concern woocommerce in a different site and I can see the data showing up in NetSuite. However, when I go through my store and place an order, and take payment, I do not see the data come into NetSuite. Do I have this code in the right location? Is there something I am missing?



Update
I installed the plugin Code Snippets and added the code there instead. Set it to Run snippet everywhere. Still no luck.










share|improve this question






























    4















    I am trying to send woocommerce order to netsuite via an external api I have written. I am nw to woocommerce and do not fully get how to add this functionality.



    I have added the following code to the functions.php file in public_html/wp-content/themes/reverie-master/



    add_action( 'woocommerce_payment_complete'', 'wdm_send_order_to_ext'); 
    function wdm_send_order_to_ext( $order_id )
    // get order object and order details
    $order = new WC_Order( $order_id );
    $email = $order->billing_email;
    $phone = $order->billing_phone;

    //Create the data object
    $orderData = array(
    'customer_email' => $email,
    'customer_phone' => $phone
    );

    $apiData = array(
    'caller' => 'woocommerce',
    'json' => $orderData,
    'key' => 'MY_SECRET_KEY'
    );

    $jsonData =json_encode($orderData);

    $url = "";
    $api_mode = 'sandbox';
    if($api_mode == 'sandbox')
    // sandbox URL example
    $url = "https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX_SB1&h=XXXXXXXXXXXXXXXX";

    else
    // production URL example
    $url = "";


    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($jsonData));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = curl_exec ($ch);

    curl_close ($ch);

    // the handle response
    if (strpos($response,'ERROR') !== false)
    print_r($response);
    else
    // success




    I have tested the brunt of this code, just the parts that do not concern woocommerce in a different site and I can see the data showing up in NetSuite. However, when I go through my store and place an order, and take payment, I do not see the data come into NetSuite. Do I have this code in the right location? Is there something I am missing?



    Update
    I installed the plugin Code Snippets and added the code there instead. Set it to Run snippet everywhere. Still no luck.










    share|improve this question


























      4












      4








      4








      I am trying to send woocommerce order to netsuite via an external api I have written. I am nw to woocommerce and do not fully get how to add this functionality.



      I have added the following code to the functions.php file in public_html/wp-content/themes/reverie-master/



      add_action( 'woocommerce_payment_complete'', 'wdm_send_order_to_ext'); 
      function wdm_send_order_to_ext( $order_id )
      // get order object and order details
      $order = new WC_Order( $order_id );
      $email = $order->billing_email;
      $phone = $order->billing_phone;

      //Create the data object
      $orderData = array(
      'customer_email' => $email,
      'customer_phone' => $phone
      );

      $apiData = array(
      'caller' => 'woocommerce',
      'json' => $orderData,
      'key' => 'MY_SECRET_KEY'
      );

      $jsonData =json_encode($orderData);

      $url = "";
      $api_mode = 'sandbox';
      if($api_mode == 'sandbox')
      // sandbox URL example
      $url = "https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX_SB1&h=XXXXXXXXXXXXXXXX";

      else
      // production URL example
      $url = "";


      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($jsonData));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      $response = curl_exec ($ch);

      curl_close ($ch);

      // the handle response
      if (strpos($response,'ERROR') !== false)
      print_r($response);
      else
      // success




      I have tested the brunt of this code, just the parts that do not concern woocommerce in a different site and I can see the data showing up in NetSuite. However, when I go through my store and place an order, and take payment, I do not see the data come into NetSuite. Do I have this code in the right location? Is there something I am missing?



      Update
      I installed the plugin Code Snippets and added the code there instead. Set it to Run snippet everywhere. Still no luck.










      share|improve this question
















      I am trying to send woocommerce order to netsuite via an external api I have written. I am nw to woocommerce and do not fully get how to add this functionality.



      I have added the following code to the functions.php file in public_html/wp-content/themes/reverie-master/



      add_action( 'woocommerce_payment_complete'', 'wdm_send_order_to_ext'); 
      function wdm_send_order_to_ext( $order_id )
      // get order object and order details
      $order = new WC_Order( $order_id );
      $email = $order->billing_email;
      $phone = $order->billing_phone;

      //Create the data object
      $orderData = array(
      'customer_email' => $email,
      'customer_phone' => $phone
      );

      $apiData = array(
      'caller' => 'woocommerce',
      'json' => $orderData,
      'key' => 'MY_SECRET_KEY'
      );

      $jsonData =json_encode($orderData);

      $url = "";
      $api_mode = 'sandbox';
      if($api_mode == 'sandbox')
      // sandbox URL example
      $url = "https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX_SB1&h=XXXXXXXXXXXXXXXX";

      else
      // production URL example
      $url = "";


      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($jsonData));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      $response = curl_exec ($ch);

      curl_close ($ch);

      // the handle response
      if (strpos($response,'ERROR') !== false)
      print_r($response);
      else
      // success




      I have tested the brunt of this code, just the parts that do not concern woocommerce in a different site and I can see the data showing up in NetSuite. However, when I go through my store and place an order, and take payment, I do not see the data come into NetSuite. Do I have this code in the right location? Is there something I am missing?



      Update
      I installed the plugin Code Snippets and added the code there instead. Set it to Run snippet everywhere. Still no luck.







      woocommerce netsuite






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 4:26







      Tom Hanson

















      asked Mar 22 at 3:50









      Tom HansonTom Hanson

      460316




      460316






















          1 Answer
          1






          active

          oldest

          votes


















          2














          It turns out there was a JS error in my code. The json_encode was on the wrong data.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292637%2fsending-order-details-from-woocommerce-to-external-system-over-api%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            It turns out there was a JS error in my code. The json_encode was on the wrong data.






            share|improve this answer



























              2














              It turns out there was a JS error in my code. The json_encode was on the wrong data.






              share|improve this answer

























                2












                2








                2







                It turns out there was a JS error in my code. The json_encode was on the wrong data.






                share|improve this answer













                It turns out there was a JS error in my code. The json_encode was on the wrong data.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 22:55









                Tom HansonTom Hanson

                460316




                460316





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292637%2fsending-order-details-from-woocommerce-to-external-system-over-api%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현