Adding Custom Post Types to Woocommerce

五迷三道 提交于 2019-12-23 14:17:08

问题


Can you please let me know if there is any way to add your own Custom Post Type to Woocommerce and use that instead of using Woocommerce Product?

Thank


回答1:


You can register a Custom Post Type regardless of WooCommerce. WooCommerce creates a "product" one so you wouldn't need that, but perhaps you want to create an "event" CPT for use with WooCommerce you can do that.

CPT Documenation

If you are planning on replacing the "product" CPT registered by WC then I would begin to question why are you using WC anyways? I suggest you make any additional CPT's you need as an extention of what WC does. Also you should study CPTs and variations, two completely different options/possible solutions for whatever you're trying to build. Variations are part of WC that offer some great options, where as CPT's are native to WP and have a very extensive ability; with them you can use woocommerce hooks to integrate with WC as needed.

Hope that helps, good luck!



来源:https://stackoverflow.com/questions/20190256/adding-custom-post-types-to-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!