Vendure → WordPress (WPGraphQL + ACF) マッピング草案¶
ステータス: Draft / 要レビュー
対象¶
- Vendure Product / ProductVariant を正とし、WordPress 側に投稿 + ACF メタを同期する。
- ACF 正本:
apps/wordpress-local/themes/ritsubi-cms/acf-json/field-groups.json(更新可)。 - 運用:
apps/wordpress-local/themesを WP のwp-content/themesにマウントし、ACF Local JSON を自動ロードする。
投稿タイプ案(単数スラッグ)¶
product: 商品本文・SEO・リッチ説明(ACF)product_variant: バリアント固有情報(必要最小限に絞る)
フィールド対応表(初版)¶
Product → product (ACF)¶
| Vendure | ACF name | 型 | 備考 |
|---|---|---|---|
| id | vendure_id | text | 同期キー(必須/非表示でも可) |
| slug | slug | text | WP側スラッグにも反映(必要なら) |
| name | title (WP標準) | – | WP投稿タイトルと一致 |
| description | rich_description | wysiwyg | リッチテキスト化 |
| featuredAsset.preview | featured_image | image | URLで保持(物理移送なし) |
| assets[*].preview | gallery | repeater(image) | 追加画像 |
| customFields.brandCode | brand_code | text | |
| customFields.categoryCode | category_code | text | |
| customFields.directShippingEligible | direct_shipping | true_false | |
| customFields.specialHandling | special_handling | true_false | |
| facetValues (category tree) | categories | taxonomy(term id) | 既存のカテゴリ構造に合わせる |
ProductVariant → product_variant (ACF)¶
| Vendure | ACF name | 型 | 備考 |
|---|---|---|---|
| id | vendure_id | text | 同期キー |
| productId | product_ref | post_object(product) | 親productへの参照 |
| sku | sku | text | 一意 |
| name | title (WP標準) | – | |
| priceWithTax | price_with_tax | number | 税込金額(参考値) |
| stockLevel | stock_level | text | 在庫ステータス文字列 |
| customFields.purchaseUnit | purchase_unit | number | |
| customFields.minimumQuantity | min_qty | number | |
| customFields.maxPerOrder | max_per_order | number | |
| customFields.isDirectShippingOnly | direct_shipping_only | true_false |
ACF 構成改善の提案¶
- リピーターの「Collapsed」キーにタイトルを設定し、折りたたみで並び替えしやすくする。
- メインバナー: 並び順はリピーターのドラッグ順に依存させ、orderフィールドを廃止しても良い。
- メディアタイプ切替(画像/動画)は現在のラジオ+条件表示を維持。
- トラッキングIDは独立フィールドのまま(URLに含めない)。
今後の実装ステップ¶
- 本マッピング表をレビュー・確定(足りない/不要フィールドの指摘歓迎)。
acf-field-groups.jsonをマッピングに合わせて更新(Collapsed設定などUX改善も含む)。- WPGraphQL mutation スキーマを固定化し、プラグインの upsert/delete 実装を追加。
- 差分判定・再同期Mutation・ログ/リトライを仕上げてE2Eテスト。