如何获取和准备要发送的WooCommerce新订单详细信息

时间:2018-06-07 20:42:58

标签: api woocommerce woocommerce-rest-api

  1. 任务是使用Api Woocommerce将新订单中的数据导入外部递送服务。
  2. 代码将写入文件function.php
  3. 交付服务的Api文档要求发送记录为:
  4. //sku

    $product[0] = "10000";//pizza

    $product[1] = "10001";//additive to pizza - cheese

    //quantity of products

    $product_kol[0] = "1";

    $product_kol[1] = "1";

    //additional product options

    $product_mod[1] = "0";//the product with key 1 is the product modifier with key 0

    1. 结论:如何获取订单数据并将其附加到此类? 我开始写作,但我不知道下一步该做什么。
    2. add_action('woocommerce_thankyou', 'send_order_to_delivery_service');

      function send_order_to_delivery_serviced( $order_id ){

      `//get order object and order details`
      
      `$order = new WC_Order( $order_id );`
      

0 个答案:

没有答案