Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/zhqi9277/zib_tool/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
子比工具
当前版本:0.2.0
子比工具是面向 Zibll 子比主题站点的辅助插件,当前内置模块为“卡密库存绑定”。
当前功能
- 在
设置 -> 子比工具统一管理插件功能 - 提供
卡密库存绑定模块,包含设置 / 卡密 / 日志 - 按子比主题真实发货逻辑识别商品与卡密的绑定关系
- 维护商品“手工库存基线”,并据此计算有效库存
- 在商品编辑页显示卡池、占用、基线和有效库存提示
库存逻辑
插件当前采用“基线库存 + 卡密池库存”模式:
- 手工库存基线存储在商品
post_meta:_zbt_shop_stock_state - 商品原始配置读取自
product_config - 有效库存计算规则:
有效库存 = min(手工库存基线, 卡池可用数量 - 待支付订单占用数量)
其中:
卡池可用数量按子比主题的card_pass / invit_code实际查询条件统计待支付订单占用数量按未支付订单统计
当前实现说明
为避免影响商品价格、支付方式等其他配置字段,插件不再通过全局 get_post_metadata 过滤器接管整份 product_config。
当前做法是:
- 识别商品卡密绑定关系
- 计算有效库存
- 仅把库存相关字段同步回
product_config.stock_all / product_config.stock_opts - 其他配置字段保持主题原值
版本变更
0.2.0
- 删除“初次同步”入口与相关逻辑
- 修正后台卡密列表缓存导致的“已识别但列表为空”问题
- 按子比主题真实发货链路校验
card_pass / invit_code / opts - 调整库存同步方案为“只同步库存字段”,避免影响价格等其他商品配置
- 新增插件版本常量
ZIB_TOOLS_VERSION
0.1.0
- 初始化子比工具插件
- 增加卡密库存绑定模块
- 增加后台设置页、卡密列表、日志页和商品编辑页库存提示