将自定义帖子类型添加到 Woocommerce [英] Adding Custom Post Types to Woocommerce

查看:34
本文介绍了将自定义帖子类型添加到 Woocommerce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否告诉我是否有任何方法可以将您自己的自定义帖子类型添加到 Woocommerce 并使用它而不是使用 Woocommerce 产品?

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?

谢谢

推荐答案

无论 WooCommerce 是什么,您都可以注册自定义帖子类型.WooCommerce 创建了一个产品"一个所以你不需要它,但也许你想创建一个事件"与 WooCommerce 一起使用的 CPT,您可以做到这一点.

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 文档

如果您打算更换产品"WC 注册了 CPT 那么我会开始质疑你为什么还要使用 WC?我建议您制作您需要的任何其他 CPT,作为 WC 功能的扩展.此外,您应该学习CPTvariations,两种完全不同的选项/可能的解决方案,适用于您尝试构建的任何内容.变化是 WC 的一部分,它提供了一些很好的选择,而 CPT 是 WP 的原生,并且具有非常广泛的能力;与他们一起,您可以使用 woocommerce hooks 与 WC 集成为需要.

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!

这篇关于将自定义帖子类型添加到 Woocommerce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆