久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='QA08P'><tr id='QA08P'><dt id='QA08P'><q id='QA08P'><span id='QA08P'><b id='QA08P'><form id='QA08P'><ins id='QA08P'></ins><ul id='QA08P'></ul><sub id='QA08P'></sub></form><legend id='QA08P'></legend><bdo id='QA08P'><pre id='QA08P'><center id='QA08P'></center></pre></bdo></b><th id='QA08P'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QA08P'><tfoot id='QA08P'></tfoot><dl id='QA08P'><fieldset id='QA08P'></fieldset></dl></div>
    <tfoot id='QA08P'></tfoot>
    <legend id='QA08P'><style id='QA08P'><dir id='QA08P'><q id='QA08P'></q></dir></style></legend>
  • <small id='QA08P'></small><noframes id='QA08P'>

    • <bdo id='QA08P'></bdo><ul id='QA08P'></ul>

        WooCommerce 按產品元查詢訂單項

        WooCommerce Query Order Items by Product Meta(WooCommerce 按產品元查詢訂單項)
      1. <legend id='Qqftm'><style id='Qqftm'><dir id='Qqftm'><q id='Qqftm'></q></dir></style></legend>
      2. <tfoot id='Qqftm'></tfoot>

              <bdo id='Qqftm'></bdo><ul id='Qqftm'></ul>

              <small id='Qqftm'></small><noframes id='Qqftm'>

                <tbody id='Qqftm'></tbody>
              <i id='Qqftm'><tr id='Qqftm'><dt id='Qqftm'><q id='Qqftm'><span id='Qqftm'><b id='Qqftm'><form id='Qqftm'><ins id='Qqftm'></ins><ul id='Qqftm'></ul><sub id='Qqftm'></sub></form><legend id='Qqftm'></legend><bdo id='Qqftm'><pre id='Qqftm'><center id='Qqftm'></center></pre></bdo></b><th id='Qqftm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qqftm'><tfoot id='Qqftm'></tfoot><dl id='Qqftm'><fieldset id='Qqftm'></fieldset></dl></div>

                • 本文介紹了WooCommerce 按產品元查詢訂單項的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  這有點奇怪,但我很難找到如何做到這一點的答案:

                  This is a bit of an odd one, but I'm having trouble finding an answer for how to do this:

                  我正在嘗試創(chuàng)建一個自定義查詢,以獲取 WooCommerce 訂單中包含的所有產品(及其元數據).

                  I'm attempting to create a custom query that gets all the products (and their meta) which are contained within a WooCommerce order.

                  例如,假設我有這些訂單待處理:

                  For example, let's say I have these orders pending:

                  • 產品 1
                  • 產品 2
                  • 產品 3
                  • 產品 4
                  • 產品 5
                  • 產品 6

                  我的目標是根據這些訂購的產品創(chuàng)建一個列表,該列表按產品的元進行排序.像這樣:

                  My goal is to create a list based off these ordered products, which is ordered by the product's meta. Something like this:

                  • 產品 1
                  • 產品 3
                  • 產品 4

                  但同樣,這些只能是訂單中的產品(包括數量).

                  But again, these would only be products (including their quantities) that sit within an order.

                  我面臨的問題是訂購商品"和訂單項元"存儲在數據庫中的數據非常有限,并且不會顯示與產品相關的所有信息.因此,換句話說,我沒有找到一種方法來獲取創(chuàng)建循環(huán)以創(chuàng)建我的列表所需的信息.

                  The problem I'm facing is that "Order Items" and "Order Item Meta" as stored in the database are quite limiting and do not display all the information associated with a product. So in other words, I'm not finding a way to get to the info I need to create the loop to create my list.

                  我的數據庫技能有限,因此不勝感激!

                  My DB skills are limited so ideas would be appreciated!

                  推薦答案

                  以下是一些可能對您有所幫助的相關代碼:

                  Here is some related code that might help you:

                  add_filter( 'woocommerce_shop_order_search_fields', 'woocommerce_shop_order_search_product_cat' );
                  
                  function woocommerce_shop_order_search_product_cat( $search_fields ) {
                  
                  $args = array(
                      'post_type' => 'shop_order'
                      );
                  
                  $orders = new WP_Query($args);
                  
                  if($orders->have_posts()) {
                          while($orders->have_posts()) {
                          $post = $orders->the_post();
                          $order_id = get_the_ID();
                          $order = new WC_Order($order_id);
                          $items = $order->get_items();
                          foreach($items as $item) {
                              $product_cats = wp_get_post_terms( $item['product_id'], 'product_cat' );
                              foreach($product_cats as $product_cat) {
                                  add_post_meta($order_id, "_product_cat", $product_cat->name);
                              }
                          }
                      }
                  };
                  
                  $search_fields[] = '_product_cat';
                  
                  return $search_fields;
                  
                  }
                  

                  這篇關于WooCommerce 按產品元查詢訂單項的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  How to use MySQL in WSL (Windows Subsystem for Linux)?(如何在 WSL(Linux 的 Windows 子系統(tǒng))中使用 MySQL?)
                  PowerShell MySQL Backup Script Error in Task Scheduler 0x00041301(任務計劃程序中的 PowerShell MySQL 備份腳本錯誤 0x00041301)
                  Import the data from the XML files into a MySQL database(將數據從 XML 文件導入 MySQL 數據庫)
                  installed Xampp on Windows 7 32-bit. Errors when starting(在 Windows 7 32 位上安裝 Xampp.啟動時的錯誤)
                  Mysql lower case table on Windows xampp(Windows xampp 上的 Mysql 小寫表)
                  • <legend id='lfYNo'><style id='lfYNo'><dir id='lfYNo'><q id='lfYNo'></q></dir></style></legend>
                    • <bdo id='lfYNo'></bdo><ul id='lfYNo'></ul>

                      <i id='lfYNo'><tr id='lfYNo'><dt id='lfYNo'><q id='lfYNo'><span id='lfYNo'><b id='lfYNo'><form id='lfYNo'><ins id='lfYNo'></ins><ul id='lfYNo'></ul><sub id='lfYNo'></sub></form><legend id='lfYNo'></legend><bdo id='lfYNo'><pre id='lfYNo'><center id='lfYNo'></center></pre></bdo></b><th id='lfYNo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lfYNo'><tfoot id='lfYNo'></tfoot><dl id='lfYNo'><fieldset id='lfYNo'></fieldset></dl></div>

                        <small id='lfYNo'></small><noframes id='lfYNo'>

                              <tbody id='lfYNo'></tbody>

                          1. <tfoot id='lfYNo'></tfoot>

                            主站蜘蛛池模板: 日韩视频在线观看一区二区 | 久久天天 | 久久精品亚洲一区 | 在线综合视频 | 一区二区三区欧美在线观看 | 久久亚洲一区 | 国产精品一区二区三区久久久 | 五月天综合网 | 91大神在线看 | 日本精品久久久久久久 | 一区二区三区四区在线 | 国产精品久久久久久久久久不蜜臀 | 欧美精品区 | www国产成人免费观看视频,深夜成人网 | 精品亚洲一区二区三区 | а√中文在线8 | 天天操天天射天天 | 日韩在线视频观看 | 在线亚洲一区 | 中文字幕 国产精品 | 精品国产精品一区二区夜夜嗨 | 可以免费看的毛片 | 色999视频| 综合久久综合久久 | 国产午夜精品一区二区三区嫩草 | 午夜精品久久久久久久久久久久久 | 日本中文字幕一区 | 一区二区免费在线 | 亚洲精品在线免费 | 国产伦精品一区二区三区四区视频 | 福利一区二区 | 高清人人天天夜夜曰狠狠狠狠 | 91在线精品视频 | 久草在线| 欧美精品网站 | 国产精品99久久免费观看 | 欧美日韩亚洲视频 | 免费看一区二区三区 | 日韩免费视频一区二区 | 伊人在线| 国产av毛片|