Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter aghigi

    (@aghigi)

    Solved!

    To insert:

    
      $json = '
        {
          "line_items": [
            {
              "id": 18984,
              "meta_data": [
                 {
                   "key": "_test",
                   "value": "angelo"
                 }
               ]
             }
           ]
         }
      ';
      $data = json_decode($json);
    
      /* Directly in PHP
      $data = (object) [
        "line_items" => [
          (object) [
            "id" => 18984,
            "meta_data" => [
              (object) [
                "key" => "_test",
                "value" => "angelo"
              ]
            ]
          ]
        ]
      ];
      */
    
      $results = $woocommerce->put('orders/5991', $data);
    

    To update:

    
      $json = '
        {
          "line_items": [
            {
              "id": 18984,
              "meta_data": [
                 {
                   "key": "_test",
                   "value": "angelo2"
                 }
               ]
             }
           ]
         }
      ';
    

    To delete:

    
      $json = '
        {
          "line_items": [
            {
              "id": 18984,
              "meta_data": [
                 {
                   "key": "_test"
                 }
               ]
             }
           ]
         }
      ';
    
    • This reply was modified 5 years, 8 months ago by aghigi.
    • This reply was modified 5 years, 8 months ago by aghigi.
    • This reply was modified 5 years, 8 months ago by aghigi.
    Thread Starter aghigi

    (@aghigi)

    If you need more context, this is what I get with $results = $woocommerce->get('orders/5991');:

    
    object(stdClass)#7 (43) {
      ["id"]=>
      int(5991)
      ["parent_id"]=>
      int(0)
      ["number"]=>
      string(4) "5991"
      ["order_key"]=>
      string(22) "wc_order_sjceFe5DRTdrG"
      ["created_via"]=>
      string(8) "checkout"
      ["version"]=>
      string(5) "4.5.2"
      ["status"]=>
      string(7) "on-hold"
      ["currency"]=>
      string(3) "EUR"
      ["date_created"]=>
      string(19) "2020-09-17T15:08:19"
      ["date_created_gmt"]=>
      string(19) "2020-09-17T13:08:19"
      ["date_modified"]=>
      string(19) "2020-09-17T15:08:20"
      ["date_modified_gmt"]=>
      string(19) "2020-09-17T13:08:20"
      ["discount_total"]=>
      string(4) "0.00"
      ["discount_tax"]=>
      string(4) "0.00"
      ["shipping_total"]=>
      string(4) "0.00"
      ["shipping_tax"]=>
      string(4) "0.00"
      ["cart_tax"]=>
      string(4) "0.00"
      ["total"]=>
      string(6) "286.00"
      ["total_tax"]=>
      string(4) "0.00"
      ["prices_include_tax"]=>
      bool(false)
      ["customer_id"]=>
      int(1)
      ["customer_ip_address"]=>
      string(12) "62.94.140.82"
      ["customer_user_agent"]=>
      string(121) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
      ["customer_note"]=>
      string(0) ""
      ["billing"]=>
      object(stdClass)#9 (11) {
        ["first_name"]=>
        string(6) "Angelo"
        ["last_name"]=>
        string(5) "Ghigi"
        ["company"]=>
        string(0) ""
        ["address_1"]=>
        string(25) "Via Giovanni Briolini, 48"
        ["address_2"]=>
        string(0) ""
        ["city"]=>
        string(6) "RIMINI"
        ["state"]=>
        string(2) "RN"
        ["postcode"]=>
        string(5) "47921"
        ["country"]=>
        string(2) "IT"
        ["email"]=>
        string(16) "angelo@ghigi.com"
        ["phone"]=>
        string(9) "054122410"
      }
      ["shipping"]=>
      object(stdClass)#10 (9) {
        ["first_name"]=>
        string(0) ""
        ["last_name"]=>
        string(0) ""
        ["company"]=>
        string(0) ""
        ["address_1"]=>
        string(0) ""
        ["address_2"]=>
        string(0) ""
        ["city"]=>
        string(0) ""
        ["state"]=>
        string(0) ""
        ["postcode"]=>
        string(0) ""
        ["country"]=>
        string(0) ""
      }
      ["payment_method"]=>
      string(4) "bacs"
      ["payment_method_title"]=>
      string(17) "Bonifico bancario"
      ["transaction_id"]=>
      string(0) ""
      ["date_paid"]=>
      NULL
      ["date_paid_gmt"]=>
      NULL
      ["date_completed"]=>
      NULL
      ["date_completed_gmt"]=>
      NULL
      ["cart_hash"]=>
      string(32) "6b002ec20e7ca3bb3db1f77bc74dfccf"
      ["meta_data"]=>
      array(1) {
        [0]=>
        object(stdClass)#11 (3) {
          ["id"]=>
          int(207607)
          ["key"]=>
          string(13) "is_vat_exempt"
          ["value"]=>
          string(2) "no"
        }
      }
      ["line_items"]=>
      array(1) {
        [0]=>
        object(stdClass)#12 (14) {
          ["id"]=>
          int(18984)
          ["name"]=>
          string(22) "VoiceBox V10 - 36 mesi"
          ["product_id"]=>
          int(86)
          ["variation_id"]=>
          int(87)
          ["quantity"]=>
          int(1)
          ["tax_class"]=>
          string(19) "it-standard-rate-22"
          ["subtotal"]=>
          string(6) "286.00"
          ["subtotal_tax"]=>
          string(4) "0.00"
          ["total"]=>
          string(6) "286.00"
          ["total_tax"]=>
          string(4) "0.00"
          ["taxes"]=>
          array(0) {
          }
          ["meta_data"]=>
          array(2) {
            [0]=>
            object(stdClass)#13 (3) {
              ["id"]=>
              int(111130)
              ["key"]=>
              string(11) "pa_garanzia"
              ["value"]=>
              string(6) "36mesi"
            }
            [1]=>
            object(stdClass)#14 (3) {
              ["id"]=>
              int(111131)
              ["key"]=>
              string(14) "_reduced_stock"
              ["value"]=>
              string(1) "1"
            }
          }
          ["sku"]=>
          string(8) "R-VB-V10"
          ["price"]=>
          int(286)
        }
      }
      ["tax_lines"]=>
      array(0) {
      }
      ["shipping_lines"]=>
      array(0) {
      }
      ["fee_lines"]=>
      array(0) {
      }
      ["coupon_lines"]=>
      array(0) {
      }
      ["refunds"]=>
      array(0) {
      }
      ["currency_symbol"]=>
      string(3) "€"
      ["_links"]=>
      object(stdClass)#16 (3) {
        ["self"]=>
        array(1) {
          [0]=>
          object(stdClass)#15 (1) {
            ["href"]=>
            string(50) "https://www.luxorweb.app/wp-json/wc/v3/orders/5991"
          }
        }
        ["collection"]=>
        array(1) {
          [0]=>
          object(stdClass)#17 (1) {
            ["href"]=>
            string(45) "https://www.luxorweb.app/wp-json/wc/v3/orders"
          }
        }
        ["customer"]=>
        array(1) {
          [0]=>
          object(stdClass)#18 (1) {
            ["href"]=>
            string(50) "https://www.luxorweb.app/wp-json/wc/v3/customers/1"
          }
        }
      }
    }
    
    • This reply was modified 5 years, 9 months ago by aghigi.
    Thread Starter aghigi

    (@aghigi)

    SOLVED!

    While doing some tests, we found out that setting the flag “Redirect to file” solved our problem

    If I got it correctly, there’s a bug in edge that crashes it if you try to access a directory for which you don’t have listing rights
    Setting the flag points the URL directly to the file, and not to the file contained in the “crashing” directory (I know it sounds strange, but that’s it)

    Once again, thanks for your support

    Thread Starter aghigi

    (@aghigi)

    Sorry, a coworker set it up and I forgot to test it before sending it to you

    I’ll write to you at the provided address and put him in the loop

    Thanks for your support

    • This reply was modified 7 years, 4 months ago by aghigi.
    Thread Starter aghigi

    (@aghigi)

    Here is your test link https://www.anastasis.it/download/65170

    I tried it and nothing shows up in the error log
    There’s only the request in access log

    2.228.5.92 - - [05/Feb/2019:15:47:03 +0100] "GET /download/65170 HTTP/1.1" 200 83695 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"

    • This reply was modified 7 years, 4 months ago by aghigi.
    • This reply was modified 7 years, 4 months ago by aghigi.
    Thread Starter aghigi

    (@aghigi)

    I did the test you asked and the download went fine

    Meanwhile, be advised that, since we have to serve downloads to our customers, we changed all the links in the page mentioned above to direct links, disabling de facto Download Monitor

    If you need a download link running through DM for test purposes, I can set you up one

    Thread Starter aghigi

    (@aghigi)

    I add a new info

    The crash happens if the DM link points to a .EXE file
    Otherwise, the download succedes

Viewing 7 replies - 1 through 7 (of 7 total)