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

將自定義帖子類型/帖子添加到 Woocommerce

Adding custom post type / post to Woocommerce(將自定義帖子類型/帖子添加到 Woocommerce)
本文介紹了將自定義帖子類型/帖子添加到 Woocommerce的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我有一個個人主題A",我希望它也可以在沒有 Woocommerce 的情況下工作.添加 Woocommerce "WC" 插件后,我會將 A 產品與 WC 集成.我有一個名為對象"的自定義帖子類型,如何通過 WC 使對象"可購買?

我已經在 StackOverflow 上看到了這個答案

I have a personal theme "A" and I want that it can also work without Woocommerce. When Woocommerce "WC" plugin is added I would integrate A products with WC. I have a custom post type called "objects", how can I make "object" buyable throught WC?

I've alredy seen this answer on StackOverflow Adding Custom Post Types to Woocommerce Where the solution in the end gives a free (not anymore) plugin to resolve.

I'd prefer to do this thing on my own, without helps of plugin. I'm curious and a pre-package solution isn't what i'm looking for.

解決方案

We can try a easy thing .. you want a custom post type to store your products and when WooCommerce is integrated the added products in your custom post type can work as woocommerce products ..

  1. Check if woocommerce is installed ot not.

  2. If not, then Create a custom post type as 'product' (similar to woocommerce).

  3. Add the custom fields similar to Woocommerce and add the products under that. (Image added for the custom fields with Woocommerce)
  4. Now, add the products under custom post type , and when woocommerce will be added it will face a issue the custom post type already exist .
  5. So if in future you want to add woocommerce to your site disable you register_post_Type function and install the WooCommerce.
  6. All the products created in Custom post type will be visible in Woocommerce products options also

To check whether woocommerce is active or not use this code

<?php
    if ( class_exists( 'WooCommerce' ) ) {
      // code that requires WooCommerce
    } else {
      // you don't appear to have WooCommerce activated
    }
    ?>

這篇關于將自定義帖子類型/帖子添加到 Woocommerce的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數(shù))
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 亚洲天堂一区二区 | 国产精品一卡二卡三卡 | 国产精品视频999 | 天堂一区二区三区四区 | 成人不卡 | 欧美一级全黄 | 日韩精品欧美精品 | 婷婷毛片| 欧美一级做a爰片免费视频 国产美女特级嫩嫩嫩bbb片 | 毛片一区| 久久美国 | 成人免费看黄网站在线观看 | 日韩美女爱爱 | 中文字幕精品视频在线观看 | 中文一区二区 | 成人片免费看 | 欧美另类视频在线 | 国产不卡在线 | 色综合99| 黄色片网站国产 | 国产精品高潮呻吟 | 国产精品欧美一区二区三区 | 国产精品久久久精品 | 欧美一级二级在线观看 | 欧洲精品一区 | 99精品一区二区 | 91在线免费视频 | 国产欧美一区二区三区国产幕精品 | 欧美激情久久久久久 | 欧美一级二级在线观看 | wwww.8888久久爱站网 | 九九热精品在线视频 | 中文字幕日韩在线 | 久久久久久亚洲精品 | 国产一区三区在线 | 亚洲欧洲成人在线 | 国产一区在线视频 | 日韩一区二区免费视频 | 久久性色 | 欧美精品网 | 亚洲一区二区三区乱码aⅴ 四虎在线视频 |