gpt4 book ai didi

php - 以编程方式创建的产品不会显示在 WooCommerce 上

转载 作者:行者123 更新时间:2023-11-29 01:36:58 25 4
gpt4 key购买 nike

我创建了一个 cron 作业来获取批发商的产品列表并将它们插入数据库。

但是当我以这种方式创建产品时,它不会显示在商店中,只会显示在管理员中。当我进入任何一个产品的编辑页面并点击保存按钮后,没有对产品进行任何更改,该产品出现在商店中。

产品会出现什么问题?

最佳答案

When inserting a product to the database, If you want it to appear on front end, you need in wp_posts table to set 'post_status' key with a value of 'publish'.
Without it, it doesn't appear on front end.

Also the 'post_date' and 'post_date_gmt' need to have a date lower than "today"

同时检查您正在设置的 wp_postmeta 表:

  • '_visibility' 'visible' 值的键
  • '_stock_status' 'instock' 值的键
  • '_stock' 具有一些值(value)……

完成后,您的产品应显示在商店页面上,无需编辑。

关于php - 以编程方式创建的产品不会显示在 WooCommerce 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39245424/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com