claude-plugin-wordpress-manager 1.4.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.claude-plugin/plugin.json +7 -3
  2. package/CHANGELOG.md +111 -0
  3. package/README.md +10 -3
  4. package/agents/wp-accessibility-auditor.md +206 -0
  5. package/agents/wp-content-strategist.md +18 -0
  6. package/agents/wp-deployment-engineer.md +34 -2
  7. package/agents/wp-performance-optimizer.md +12 -0
  8. package/agents/wp-security-auditor.md +20 -0
  9. package/agents/wp-security-hardener.md +266 -0
  10. package/agents/wp-site-manager.md +14 -0
  11. package/agents/wp-test-engineer.md +207 -0
  12. package/docs/GUIDE.md +68 -15
  13. package/docs/guides/INDEX.md +46 -0
  14. package/docs/guides/wp-blog.md +590 -0
  15. package/docs/guides/wp-design-system.md +976 -0
  16. package/docs/guides/wp-ecommerce.md +786 -0
  17. package/docs/guides/wp-landing-page.md +762 -0
  18. package/docs/guides/wp-portfolio.md +713 -0
  19. package/docs/plans/2026-02-27-design-system-guide-design.md +30 -0
  20. package/docs/plans/2026-02-27-local-dev-tools-assessment.md +332 -0
  21. package/docs/plans/2026-02-27-local-env-design.md +179 -0
  22. package/docs/plans/2026-02-27-site-type-guides-design.md +44 -0
  23. package/package.json +7 -3
  24. package/skills/wordpress-router/SKILL.md +25 -5
  25. package/skills/wordpress-router/references/decision-tree.md +59 -3
  26. package/skills/wp-accessibility/SKILL.md +170 -0
  27. package/skills/wp-accessibility/references/a11y-audit-tools.md +248 -0
  28. package/skills/wp-accessibility/references/a11y-testing.md +222 -0
  29. package/skills/wp-accessibility/references/block-a11y.md +247 -0
  30. package/skills/wp-accessibility/references/interactive-a11y.md +272 -0
  31. package/skills/wp-accessibility/references/media-a11y.md +254 -0
  32. package/skills/wp-accessibility/references/theme-a11y.md +309 -0
  33. package/skills/wp-audit/SKILL.md +4 -0
  34. package/skills/wp-block-development/SKILL.md +5 -0
  35. package/skills/wp-block-themes/SKILL.md +4 -0
  36. package/skills/wp-deploy/SKILL.md +12 -0
  37. package/skills/wp-e2e-testing/SKILL.md +186 -0
  38. package/skills/wp-e2e-testing/references/ci-integration.md +174 -0
  39. package/skills/wp-e2e-testing/references/jest-wordpress.md +114 -0
  40. package/skills/wp-e2e-testing/references/phpunit-wordpress.md +141 -0
  41. package/skills/wp-e2e-testing/references/playwright-wordpress.md +108 -0
  42. package/skills/wp-e2e-testing/references/test-data-generation.md +127 -0
  43. package/skills/wp-e2e-testing/references/visual-regression.md +107 -0
  44. package/skills/wp-e2e-testing/references/wp-env-setup.md +97 -0
  45. package/skills/wp-e2e-testing/scripts/test_inspect.mjs +375 -0
  46. package/skills/wp-headless/SKILL.md +168 -0
  47. package/skills/wp-headless/references/api-layer-choice.md +160 -0
  48. package/skills/wp-headless/references/cors-config.md +245 -0
  49. package/skills/wp-headless/references/frontend-integration.md +331 -0
  50. package/skills/wp-headless/references/headless-auth.md +286 -0
  51. package/skills/wp-headless/references/webhooks.md +277 -0
  52. package/skills/wp-headless/references/wpgraphql.md +331 -0
  53. package/skills/wp-headless/scripts/headless_inspect.mjs +321 -0
  54. package/skills/wp-i18n/SKILL.md +170 -0
  55. package/skills/wp-i18n/references/js-i18n.md +201 -0
  56. package/skills/wp-i18n/references/multilingual-setup.md +219 -0
  57. package/skills/wp-i18n/references/php-i18n.md +196 -0
  58. package/skills/wp-i18n/references/rtl-support.md +206 -0
  59. package/skills/wp-i18n/references/translation-workflow.md +178 -0
  60. package/skills/wp-i18n/references/wpcli-i18n.md +177 -0
  61. package/skills/wp-i18n/scripts/i18n_inspect.mjs +330 -0
  62. package/skills/wp-interactivity-api/SKILL.md +4 -0
  63. package/skills/wp-local-env/SKILL.md +233 -0
  64. package/skills/wp-local-env/references/localwp-adapter.md +156 -0
  65. package/skills/wp-local-env/references/mcp-adapter-setup.md +153 -0
  66. package/skills/wp-local-env/references/studio-adapter.md +127 -0
  67. package/skills/wp-local-env/references/wpenv-adapter.md +121 -0
  68. package/skills/wp-local-env/scripts/detect_local_env.mjs +404 -0
  69. package/skills/wp-playground/SKILL.md +13 -1
  70. package/skills/wp-plugin-development/SKILL.md +6 -0
  71. package/skills/wp-rest-api/SKILL.md +4 -0
  72. package/skills/wp-security/SKILL.md +179 -0
  73. package/skills/wp-security/references/api-restriction.md +147 -0
  74. package/skills/wp-security/references/authentication-hardening.md +105 -0
  75. package/skills/wp-security/references/filesystem-hardening.md +105 -0
  76. package/skills/wp-security/references/http-headers.md +105 -0
  77. package/skills/wp-security/references/incident-response.md +144 -0
  78. package/skills/wp-security/references/user-capabilities.md +115 -0
  79. package/skills/wp-security/references/wp-config-security.md +129 -0
  80. package/skills/wp-security/scripts/security_inspect.mjs +393 -0
  81. package/skills/wp-wpcli-and-ops/SKILL.md +6 -0
@@ -0,0 +1,786 @@
1
+ # WordPress E-commerce — Guida Completa
2
+
3
+ **Tipologia:** E-commerce (negozio online con WooCommerce)
4
+ **Versione:** 1.0.0
5
+ **Ultima modifica:** 2026-02-28
6
+ **Skill correlate:** wp-block-themes, wp-local-env, wp-deploy, wp-performance, wp-plugin-development, wp-rest-api
7
+
8
+ ---
9
+
10
+ ## 1. Panoramica
11
+
12
+ ### Cos'e un E-commerce WordPress
13
+
14
+ Un e-commerce WordPress e un negozio online costruito con WooCommerce, il plugin di commercio elettronico piu diffuso al mondo (68%+ market share tra le soluzioni e-commerce). WooCommerce trasforma WordPress in una piattaforma di vendita completa: catalogo prodotti, carrello, checkout, gestione ordini, spedizioni e pagamenti.
15
+
16
+ ### Quando scegliere WooCommerce
17
+
18
+ - **Vendita prodotti fisici**: abbigliamento, food & beverage, artigianato
19
+ - **Prodotti digitali**: ebook, corsi, software, template
20
+ - **Servizi**: consulenze, prenotazioni, abbonamenti
21
+ - **Abbonamenti/subscription**: box mensili, SaaS, membership
22
+ - **Marketplace**: piattaforma multi-vendor
23
+
24
+ ### Varianti business model
25
+
26
+ | Modello | Descrizione | Plugin aggiuntivo |
27
+ |---------|-------------|-------------------|
28
+ | **B2C** | Vendita diretta al consumatore | WooCommerce core |
29
+ | **B2B** | Vendita ad aziende (prezzi su richiesta, quantita minime) | B2BKing, WooCommerce B2B |
30
+ | **D2C** | Brand che vende senza intermediari | WooCommerce core |
31
+ | **Marketplace** | Multi-vendor, commissioni | Dokan, WCFM |
32
+ | **Subscription** | Abbonamenti ricorrenti | WooCommerce Subscriptions |
33
+
34
+ ### Metriche chiave
35
+
36
+ | Metrica | Cosa misura | Benchmark |
37
+ |---------|-------------|-----------|
38
+ | Conversion Rate | % visitatori che acquistano | 1-3% (media e-commerce) |
39
+ | AOV (Average Order Value) | Valore medio dell'ordine | Varia per settore |
40
+ | Cart Abandonment Rate | % che abbandona il carrello | 65-75% (media) |
41
+ | CLV (Customer Lifetime Value) | Valore totale di un cliente | AOV x frequenza x durata |
42
+ | Revenue per Visitor | Fatturato per visitatore | Conversion Rate x AOV |
43
+ | Return Rate | % prodotti resi | < 10% (buono) |
44
+
45
+ ---
46
+
47
+ ## 2. Per l'Utente
48
+
49
+ Questa sezione copre la gestione operativa del negozio tramite Claude Code e il plugin wordpress-manager.
50
+
51
+ ### 2.1 Concept e Pianificazione
52
+
53
+ **Definisci il modello di business prima di installare WooCommerce.**
54
+
55
+ 1. **Catalogo**: quanti prodotti? Semplici o con varianti (taglia, colore)?
56
+ 2. **Pricing**: prezzo fisso, scontato, per quantita, su richiesta?
57
+ 3. **Spedizioni**: corriere (GLS, BRT, Poste), soglia gratuita, ritiro in sede?
58
+ 4. **Pagamenti**: Stripe, PayPal, bonifico, contrassegno, Satispay?
59
+ 5. **Tasse**: IVA italiana (22%, 10%, 4%), vendita in EU?
60
+ 6. **Legale**: privacy policy, termini di vendita, diritto di recesso (14 giorni)
61
+
62
+ ### 2.2 Setup Ambiente Locale
63
+
64
+ **Creare un negozio WordPress locale con wp-env + WooCommerce:**
65
+
66
+ ```bash
67
+ # 1. Creare la directory del progetto
68
+ mkdir -p ~/projects/mio-shop
69
+ cd ~/projects/mio-shop
70
+
71
+ # 2. Creare .wp-env.json con WooCommerce
72
+ cat > .wp-env.json << 'EOF'
73
+ {
74
+ "core": "WordPress/WordPress#master",
75
+ "themes": ["./themes/shop-theme"],
76
+ "plugins": [
77
+ "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip"
78
+ ],
79
+ "config": {
80
+ "WP_DEBUG": true,
81
+ "WP_DEBUG_LOG": true,
82
+ "SCRIPT_DEBUG": true
83
+ },
84
+ "port": 8888
85
+ }
86
+ EOF
87
+
88
+ # 3. Creare la struttura del tema
89
+ mkdir -p themes/shop-theme/{templates,parts,patterns}
90
+
91
+ # 4. Avviare WordPress
92
+ npx wp-env start
93
+ ```
94
+
95
+ **Con Claude Code (linguaggio naturale):**
96
+
97
+ > "Crea un nuovo progetto WordPress e-commerce con wp-env e WooCommerce, tema block con colori brand verdi, homepage con prodotti in evidenza"
98
+
99
+ **Credenziali default wp-env:** `admin` / `password` su `http://localhost:8888/wp-admin/`
100
+
101
+ #### Configurazione iniziale WooCommerce
102
+
103
+ ```bash
104
+ # Impostare valuta e localizzazione
105
+ npx wp-env run cli wp option update woocommerce_currency EUR
106
+ npx wp-env run cli wp option update woocommerce_currency_pos left_space
107
+ npx wp-env run cli wp option update woocommerce_price_decimal_sep ","
108
+ npx wp-env run cli wp option update woocommerce_price_thousand_sep "."
109
+ npx wp-env run cli wp option update woocommerce_default_country "IT"
110
+
111
+ # Impostare le pagine WooCommerce
112
+ npx wp-env run cli wp wc tool run install_pages --user=1
113
+ ```
114
+
115
+ ### 2.3 Gestione Prodotti
116
+
117
+ #### Tipologie prodotto
118
+
119
+ | Tipo | Descrizione | Esempio |
120
+ |------|-------------|---------|
121
+ | **Semplice** | Un prodotto, un prezzo | Bottiglia singola |
122
+ | **Variabile** | Piu varianti (taglia, colore) | T-shirt S/M/L/XL |
123
+ | **Raggruppato** | Insieme di prodotti correlati | Kit degustazione |
124
+ | **Virtuale/Scaricabile** | Nessuna spedizione, download | Ebook, corso video |
125
+
126
+ #### Creare prodotti via WP-CLI
127
+
128
+ ```bash
129
+ # Prodotto semplice
130
+ npx wp-env run cli wp wc product create \
131
+ --name="Acqua di Cactus Poco Dolce" \
132
+ --type=simple \
133
+ --regular_price=3.50 \
134
+ --description="Bevanda naturale a base di acqua di cactus siciliano. Zero calorie." \
135
+ --short_description="Cactus water naturale, zero calorie" \
136
+ --categories='[{"id": 1}]' \
137
+ --manage_stock=true \
138
+ --stock_quantity=100 \
139
+ --weight="0.5" \
140
+ --user=1
141
+
142
+ # Prodotto variabile (creare prima il prodotto padre, poi le varianti)
143
+ npx wp-env run cli wp wc product create \
144
+ --name="T-Shirt DolceZero" \
145
+ --type=variable \
146
+ --description="T-shirt ufficiale del brand" \
147
+ --attributes='[{"name":"Taglia","options":["S","M","L","XL"],"variation":true,"visible":true}]' \
148
+ --user=1
149
+
150
+ # Elencare i prodotti
151
+ npx wp-env run cli wp wc product list --user=1 --fields=id,name,price,stock_quantity
152
+
153
+ # Aggiornare prezzo
154
+ npx wp-env run cli wp wc product update 12 --regular_price=4.00 --user=1
155
+ ```
156
+
157
+ #### Categorie prodotto
158
+
159
+ ```bash
160
+ # Creare categorie
161
+ npx wp-env run cli wp wc product_cat create --name="Bevande" --user=1
162
+ npx wp-env run cli wp wc product_cat create --name="Box e Kit" --user=1
163
+ npx wp-env run cli wp wc product_cat create --name="Accessori" --user=1
164
+
165
+ # Elencare categorie
166
+ npx wp-env run cli wp wc product_cat list --user=1
167
+ ```
168
+
169
+ ### 2.4 Ordini e Clienti
170
+
171
+ ```bash
172
+ # Elencare ordini recenti
173
+ npx wp-env run cli wp wc order list --user=1 --fields=id,status,total,date_created
174
+
175
+ # Aggiornare stato ordine
176
+ npx wp-env run cli wp wc order update 15 --status=completed --user=1
177
+
178
+ # Elencare clienti
179
+ npx wp-env run cli wp wc customer list --user=1 --fields=id,email,first_name,orders_count
180
+
181
+ # Report vendite
182
+ npx wp-env run cli wp wc report sales --user=1 --period=month
183
+ ```
184
+
185
+ ### 2.5 Coupon e Promozioni
186
+
187
+ ```bash
188
+ # Creare coupon sconto percentuale
189
+ npx wp-env run cli wp wc coupon create \
190
+ --code="BENVENUTO10" \
191
+ --discount_type=percent \
192
+ --amount=10 \
193
+ --individual_use=true \
194
+ --usage_limit=1 \
195
+ --usage_limit_per_user=1 \
196
+ --user=1
197
+
198
+ # Creare coupon spedizione gratuita
199
+ npx wp-env run cli wp wc coupon create \
200
+ --code="SPEDIZIONEGRATIS" \
201
+ --discount_type=percent \
202
+ --amount=0 \
203
+ --free_shipping=true \
204
+ --minimum_amount=30 \
205
+ --user=1
206
+
207
+ # Elencare coupon
208
+ npx wp-env run cli wp wc coupon list --user=1
209
+ ```
210
+
211
+ ### 2.6 Tasse e Spedizioni
212
+
213
+ #### IVA italiana
214
+
215
+ ```bash
216
+ # Abilitare tasse
217
+ npx wp-env run cli wp option update woocommerce_calc_taxes "yes"
218
+
219
+ # Prezzi IVA inclusa (standard B2C Italia)
220
+ npx wp-env run cli wp option update woocommerce_prices_include_tax "yes"
221
+ npx wp-env run cli wp option update woocommerce_tax_display_shop "incl"
222
+ npx wp-env run cli wp option update woocommerce_tax_display_cart "incl"
223
+
224
+ # Creare aliquote IVA
225
+ npx wp-env run cli wp wc tax create \
226
+ --country=IT --rate=22 --name="IVA 22%" --priority=1 --class=standard --user=1
227
+
228
+ npx wp-env run cli wp wc tax create \
229
+ --country=IT --rate=10 --name="IVA 10%" --priority=1 --class=reduced-rate --user=1
230
+
231
+ npx wp-env run cli wp wc tax create \
232
+ --country=IT --rate=4 --name="IVA 4%" --priority=1 --class=zero-rate --user=1
233
+ ```
234
+
235
+ #### Zone spedizione
236
+
237
+ ```bash
238
+ # Creare zona Italia
239
+ npx wp-env run cli wp wc shipping_zone create --name="Italia" --user=1
240
+
241
+ # Aggiungere metodo tariffa fissa
242
+ npx wp-env run cli wp wc shipping_zone_method create 1 \
243
+ --method_id=flat_rate --user=1
244
+
245
+ # Aggiungere spedizione gratuita (ordini > 50 EUR)
246
+ npx wp-env run cli wp wc shipping_zone_method create 1 \
247
+ --method_id=free_shipping --user=1
248
+ ```
249
+
250
+ ### 2.7 Email Transazionali
251
+
252
+ ```bash
253
+ # Verificare email configurate
254
+ npx wp-env run cli wp option get woocommerce_email_from_name
255
+ npx wp-env run cli wp option get woocommerce_email_from_address
256
+
257
+ # Personalizzare mittente
258
+ npx wp-env run cli wp option update woocommerce_email_from_name "Mio Shop"
259
+ npx wp-env run cli wp option update woocommerce_email_from_address "ordini@mioshop.it"
260
+ ```
261
+
262
+ **Email automatiche WooCommerce:**
263
+
264
+ | Email | Destinatario | Trigger |
265
+ |-------|-------------|---------|
266
+ | Nuovo ordine | Admin | Ordine ricevuto |
267
+ | Ordine in lavorazione | Cliente | Pagamento confermato |
268
+ | Ordine completato | Cliente | Ordine spedito |
269
+ | Ordine rimborsato | Cliente | Rimborso emesso |
270
+ | Nuovo account | Cliente | Registrazione |
271
+ | Nota cliente | Cliente | Admin aggiunge nota |
272
+
273
+ **Importante**: installa WP Mail SMTP per garantire la deliverability delle email transazionali.
274
+
275
+ ### 2.8 Gateway di Pagamento
276
+
277
+ | Gateway | Tipo | Commissione | Quando usarlo |
278
+ |---------|------|-------------|---------------|
279
+ | **Stripe** | Carta di credito | 1.4% + 0.25 EUR (EU) | Standard per e-commerce |
280
+ | **PayPal** | PayPal + carta | 2.9% + 0.35 EUR | Ampia diffusione |
281
+ | **Bonifico (BACS)** | Manuale | 0 | B2B, ordini grandi |
282
+ | **Contrassegno** | Alla consegna | 0 (+ supplemento) | Italia, fiducia |
283
+ | **Satispay** | Mobile payment | 0.20 EUR fisso | Italia, micro-pagamenti |
284
+
285
+ ```bash
286
+ # Abilitare Stripe test mode
287
+ npx wp-env run cli wp option update woocommerce_stripe_settings \
288
+ '{"enabled":"yes","testmode":"yes","test_publishable_key":"pk_test_xxx","test_secret_key":"sk_test_xxx"}' \
289
+ --format=json --user=1
290
+ ```
291
+
292
+ ---
293
+
294
+ ## 3. Per lo Sviluppatore
295
+
296
+ Questa sezione copre l'architettura tecnica e le best practice per sviluppare un block theme per e-commerce.
297
+
298
+ ### 3.1 Architettura Theme
299
+
300
+ Un block theme WooCommerce-ready:
301
+
302
+ ```
303
+ themes/shop-theme/
304
+ ├── style.css # Header theme + dichiarazione WooCommerce support
305
+ ├── theme.json # Design tokens e stili globali
306
+ ├── functions.php # WooCommerce support, font, hooks
307
+ ├── templates/
308
+ │ ├── index.html # Fallback
309
+ │ ├── front-page.html # Homepage con prodotti in evidenza
310
+ │ ├── single-product.html # Singolo prodotto (WooCommerce)
311
+ │ ├── archive-product.html # Catalogo / shop page
312
+ │ ├── page-cart.html # Carrello (opzionale)
313
+ │ ├── page-checkout.html # Checkout (opzionale)
314
+ │ ├── page.html # Pagina generica
315
+ │ └── 404.html # Pagina non trovata
316
+ ├── parts/
317
+ │ ├── header.html # Header con logo + nav + carrello
318
+ │ └── footer.html # Footer con info aziendali
319
+ └── patterns/
320
+ ├── product-showcase.php # Prodotti in evidenza
321
+ ├── category-grid.php # Griglia categorie
322
+ └── trust-badges.php # Badge fiducia
323
+ ```
324
+
325
+ #### functions.php — WooCommerce Support
326
+
327
+ ```php
328
+ <?php
329
+ // Dichiarare supporto WooCommerce
330
+ function shop_theme_setup() {
331
+ add_theme_support('woocommerce');
332
+ add_theme_support('wc-product-gallery-zoom');
333
+ add_theme_support('wc-product-gallery-lightbox');
334
+ add_theme_support('wc-product-gallery-slider');
335
+ }
336
+ add_action('after_setup_theme', 'shop_theme_setup');
337
+ ```
338
+
339
+ ### 3.2 theme.json — Design Tokens per E-commerce
340
+
341
+ ```json
342
+ {
343
+ "$schema": "https://schemas.wp.org/wp/6.7/theme.json",
344
+ "version": 3,
345
+ "settings": {
346
+ "color": {
347
+ "palette": [
348
+ { "slug": "base", "color": "#ffffff", "name": "Base" },
349
+ { "slug": "contrast", "color": "#111827", "name": "Contrast" },
350
+ { "slug": "accent", "color": "#2D5016", "name": "Accent (Brand)" },
351
+ { "slug": "cta", "color": "#E85D04", "name": "CTA (Acquista)" },
352
+ { "slug": "cta-hover", "color": "#d4520a", "name": "CTA Hover" },
353
+ { "slug": "surface", "color": "#f3f4f6", "name": "Surface" },
354
+ { "slug": "muted", "color": "#6b7280", "name": "Muted" },
355
+ { "slug": "success", "color": "#22c55e", "name": "Success" },
356
+ { "slug": "warning", "color": "#f59e0b", "name": "Warning" },
357
+ { "slug": "error", "color": "#ef4444", "name": "Error" },
358
+ { "slug": "sale", "color": "#ef4444", "name": "Sale Badge" },
359
+ { "slug": "border", "color": "#e5e7eb", "name": "Border" }
360
+ ],
361
+ "defaultPalette": false
362
+ },
363
+ "typography": {
364
+ "fontFamilies": [
365
+ {
366
+ "fontFamily": "'Inter', -apple-system, sans-serif",
367
+ "slug": "body",
368
+ "name": "Body"
369
+ },
370
+ {
371
+ "fontFamily": "'DM Sans', 'Inter', sans-serif",
372
+ "slug": "heading",
373
+ "name": "Heading"
374
+ }
375
+ ],
376
+ "fontSizes": [
377
+ { "slug": "small", "size": "0.875rem" },
378
+ { "slug": "medium", "size": "1rem" },
379
+ { "slug": "large", "size": "1.25rem" },
380
+ { "slug": "x-large", "size": "1.75rem" },
381
+ { "slug": "xx-large", "size": "2.5rem" }
382
+ ]
383
+ },
384
+ "layout": {
385
+ "contentSize": "1100px",
386
+ "wideSize": "1400px"
387
+ }
388
+ },
389
+ "styles": {
390
+ "elements": {
391
+ "button": {
392
+ "color": {
393
+ "background": "var(--wp--preset--color--cta)",
394
+ "text": "var(--wp--preset--color--base)"
395
+ },
396
+ "typography": { "fontWeight": "600" },
397
+ "border": { "radius": "8px" },
398
+ ":hover": {
399
+ "color": { "background": "var(--wp--preset--color--cta-hover)" }
400
+ }
401
+ }
402
+ }
403
+ }
404
+ }
405
+ ```
406
+
407
+ **Nota**: nell'e-commerce servono piu colori che in un blog — `success` per conferme, `error` per errori form, `sale` per badge sconto, `cta` separato dall'accent brand.
408
+
409
+ ### 3.3 WooCommerce Blocks vs Shortcodes
410
+
411
+ WooCommerce offre due approcci per le pagine shop:
412
+
413
+ | Approccio | Pro | Contro |
414
+ |-----------|-----|--------|
415
+ | **Blocks** (moderno) | Editabile nell'editor, responsive, personalizzabile | Richiede WooCommerce 8.0+ |
416
+ | **Shortcodes** (legacy) | Compatibilita universale | Non editabile visualmente |
417
+
418
+ **Per block theme, usa sempre i blocks WooCommerce.**
419
+
420
+ Pagine chiave generate automaticamente:
421
+
422
+ ```bash
423
+ # Verificare le pagine WooCommerce
424
+ npx wp-env run cli wp option get woocommerce_shop_page_id
425
+ npx wp-env run cli wp option get woocommerce_cart_page_id
426
+ npx wp-env run cli wp option get woocommerce_checkout_page_id
427
+ npx wp-env run cli wp option get woocommerce_myaccount_page_id
428
+ ```
429
+
430
+ ### 3.4 WooCommerce Hooks Essenziali
431
+
432
+ WooCommerce espone centinaia di action e filter hooks:
433
+
434
+ ```php
435
+ <?php
436
+ // === PAGINA PRODOTTO ===
437
+
438
+ // Badge "Spedizione gratuita" sopra il titolo
439
+ add_action('woocommerce_single_product_summary', function() {
440
+ global $product;
441
+ if ($product->get_price() >= 50) {
442
+ echo '<span class="free-shipping-badge">Spedizione gratuita</span>';
443
+ }
444
+ }, 4);
445
+
446
+ // Tab custom nella pagina prodotto
447
+ add_filter('woocommerce_product_tabs', function($tabs) {
448
+ $tabs['ingredienti'] = [
449
+ 'title' => 'Ingredienti',
450
+ 'priority' => 15,
451
+ 'callback' => function() {
452
+ global $product;
453
+ $ingredienti = $product->get_meta('_ingredienti');
454
+ if ($ingredienti) {
455
+ echo '<h2>Ingredienti</h2>';
456
+ echo '<p>' . esc_html($ingredienti) . '</p>';
457
+ }
458
+ }
459
+ ];
460
+ return $tabs;
461
+ });
462
+
463
+ // === CARRELLO ===
464
+
465
+ // Messaggio soglia spedizione gratuita
466
+ add_action('woocommerce_before_cart', function() {
467
+ $soglia = 50;
468
+ $totale = WC()->cart->get_subtotal();
469
+ $mancante = $soglia - $totale;
470
+
471
+ if ($mancante > 0) {
472
+ wc_print_notice(
473
+ sprintf('Aggiungi %s per la spedizione gratuita!', wc_price($mancante)),
474
+ 'notice'
475
+ );
476
+ } else {
477
+ wc_print_notice('Hai la spedizione gratuita!', 'success');
478
+ }
479
+ });
480
+
481
+ // === CHECKOUT ===
482
+
483
+ // Aggiungere campo Codice Fiscale (obbligatorio in Italia)
484
+ add_filter('woocommerce_checkout_fields', function($fields) {
485
+ $fields['billing']['billing_codice_fiscale'] = [
486
+ 'type' => 'text',
487
+ 'label' => 'Codice Fiscale',
488
+ 'required' => true,
489
+ 'priority' => 35,
490
+ 'class' => ['form-row-wide'],
491
+ 'placeholder' => 'RSSMRA80A01H501U',
492
+ ];
493
+ return $fields;
494
+ });
495
+
496
+ // Salvare il Codice Fiscale nell'ordine
497
+ add_action('woocommerce_checkout_update_order_meta', function($order_id) {
498
+ if (!empty($_POST['billing_codice_fiscale'])) {
499
+ update_post_meta($order_id, '_billing_codice_fiscale',
500
+ sanitize_text_field($_POST['billing_codice_fiscale']));
501
+ }
502
+ });
503
+ ```
504
+
505
+ **Priorita hooks pagina prodotto:**
506
+
507
+ | Priorita | Elemento |
508
+ |----------|----------|
509
+ | 5 | Titolo |
510
+ | 10 | Prezzo |
511
+ | 20 | Excerpt |
512
+ | 25 | Rating |
513
+ | 30 | Add to cart |
514
+ | 40 | Meta (SKU, categorie) |
515
+
516
+ ### 3.5 REST API per Headless Commerce
517
+
518
+ WooCommerce espone una REST API completa:
519
+
520
+ ```bash
521
+ # Generare chiavi API
522
+ npx wp-env run cli wp wc api_key create \
523
+ --user=1 --description="Headless Frontend" --permissions=read_write
524
+
525
+ # Elencare prodotti
526
+ curl -s "http://localhost:8888/wp-json/wc/v3/products" \
527
+ -u "ck_xxxx:cs_xxxx" | jq '.[].name'
528
+
529
+ # Creare ordine via API
530
+ curl -X POST "http://localhost:8888/wp-json/wc/v3/orders" \
531
+ -u "ck_xxxx:cs_xxxx" \
532
+ -H "Content-Type: application/json" \
533
+ -d '{
534
+ "payment_method": "bacs",
535
+ "billing": {
536
+ "first_name": "Mario",
537
+ "last_name": "Rossi",
538
+ "email": "mario@example.com",
539
+ "address_1": "Via Roma 1",
540
+ "city": "Milano",
541
+ "postcode": "20100",
542
+ "country": "IT"
543
+ },
544
+ "line_items": [{"product_id": 12, "quantity": 2}]
545
+ }'
546
+ ```
547
+
548
+ **Endpoint principali:**
549
+
550
+ | Endpoint | Descrizione |
551
+ |----------|-------------|
552
+ | `/wc/v3/products` | Gestione prodotti |
553
+ | `/wc/v3/orders` | Gestione ordini |
554
+ | `/wc/v3/customers` | Gestione clienti |
555
+ | `/wc/v3/coupons` | Gestione coupon |
556
+ | `/wc/v3/reports/sales` | Report vendite |
557
+ | `/wc/store/cart` | Cart API frontend (no auth) |
558
+
559
+ **Store API vs WC REST API:** La Store API (`/wc/store/`) e pensata per il frontend (carrello, checkout) e non richiede autenticazione. La WC REST API (`/wc/v3/`) e per operazioni backend e richiede chiavi API.
560
+
561
+ ### 3.6 Patterns
562
+
563
+ #### Pattern: Vetrina Prodotti in Evidenza
564
+
565
+ ```php
566
+ <?php
567
+ /**
568
+ * Title: Vetrina Prodotti in Evidenza
569
+ * Slug: shop-theme/product-showcase
570
+ * Categories: woocommerce
571
+ */
572
+ ?>
573
+ <!-- wp:group {"style":{"spacing":{"padding":{"top":"3rem","bottom":"3rem"}}},"layout":{"type":"constrained"}} -->
574
+ <div class="wp-block-group" style="padding:3rem 0">
575
+ <!-- wp:heading {"textAlign":"center","level":2} -->
576
+ <h2 class="wp-block-heading has-text-align-center">I Nostri Bestseller</h2>
577
+ <!-- /wp:heading -->
578
+ <!-- wp:paragraph {"align":"center","textColor":"muted"} -->
579
+ <p class="has-text-align-center has-muted-color has-text-color">Scopri i prodotti piu amati dai nostri clienti</p>
580
+ <!-- /wp:paragraph -->
581
+ <!-- wp:woocommerce/product-collection {"query":{"perPage":4,"featured":true},"displayLayout":{"type":"flex","columns":4}} -->
582
+ <div class="wp-block-woocommerce-product-collection">
583
+ <!-- wp:woocommerce/product-template -->
584
+ <!-- wp:woocommerce/product-image {"imageSizing":"thumbnail","style":{"border":{"radius":"8px"}}} /-->
585
+ <!-- wp:post-title {"textAlign":"center","isLink":true,"fontSize":"medium"} /-->
586
+ <!-- wp:woocommerce/product-price {"textAlign":"center"} /-->
587
+ <!-- wp:woocommerce/product-button {"textAlign":"center","text":"Aggiungi al carrello"} /-->
588
+ <!-- /wp:woocommerce/product-template -->
589
+ </div>
590
+ <!-- /wp:woocommerce/product-collection -->
591
+ </div>
592
+ <!-- /wp:group -->
593
+ ```
594
+
595
+ #### Pattern: Badge Fiducia
596
+
597
+ ```php
598
+ <?php
599
+ /**
600
+ * Title: Badge Fiducia
601
+ * Slug: shop-theme/trust-badges
602
+ * Categories: woocommerce
603
+ */
604
+ ?>
605
+ <!-- wp:group {"style":{"spacing":{"padding":{"top":"2rem","bottom":"2rem"}},"border":{"top":{"color":"var(--wp--preset--color--border)","width":"1px"},"bottom":{"color":"var(--wp--preset--color--border)","width":"1px"}}},"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"center"}} -->
606
+ <div class="wp-block-group" style="border-top:1px solid var(--wp--preset--color--border);border-bottom:1px solid var(--wp--preset--color--border);padding:2rem">
607
+ <!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"center"}} -->
608
+ <div class="wp-block-group">
609
+ <!-- wp:paragraph {"align":"center","fontSize":"small"} -->
610
+ <p class="has-text-align-center has-small-font-size"><strong>Pagamento Sicuro</strong><br>SSL 256-bit</p>
611
+ <!-- /wp:paragraph -->
612
+ </div>
613
+ <!-- /wp:group -->
614
+ <!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"center"}} -->
615
+ <div class="wp-block-group">
616
+ <!-- wp:paragraph {"align":"center","fontSize":"small"} -->
617
+ <p class="has-text-align-center has-small-font-size"><strong>Spedizione Gratuita</strong><br>Ordini sopra 50 EUR</p>
618
+ <!-- /wp:paragraph -->
619
+ </div>
620
+ <!-- /wp:group -->
621
+ <!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"center"}} -->
622
+ <div class="wp-block-group">
623
+ <!-- wp:paragraph {"align":"center","fontSize":"small"} -->
624
+ <p class="has-text-align-center has-small-font-size"><strong>Reso Facile</strong><br>30 giorni per ripensarci</p>
625
+ <!-- /wp:paragraph -->
626
+ </div>
627
+ <!-- /wp:group -->
628
+ <!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"center"}} -->
629
+ <div class="wp-block-group">
630
+ <!-- wp:paragraph {"align":"center","fontSize":"small"} -->
631
+ <p class="has-text-align-center has-small-font-size"><strong>4.8/5 Stelle</strong><br>500+ recensioni</p>
632
+ <!-- /wp:paragraph -->
633
+ </div>
634
+ <!-- /wp:group -->
635
+ </div>
636
+ <!-- /wp:group -->
637
+ ```
638
+
639
+ ### 3.7 Performance per Catalogo Grande
640
+
641
+ Un catalogo con 1000+ prodotti richiede ottimizzazioni specifiche.
642
+
643
+ ```bash
644
+ # Object Cache con Redis
645
+ npx wp-env run cli wp plugin install redis-cache --activate
646
+ npx wp-env run cli wp redis enable
647
+
648
+ # HPOS — High Performance Order Storage (WooCommerce 8.0+)
649
+ npx wp-env run cli wp option update woocommerce_custom_orders_table_enabled "yes"
650
+
651
+ # Ottimizzare dimensioni immagini prodotto
652
+ npx wp-env run cli wp option update woocommerce_single_image_width 800
653
+ npx wp-env run cli wp option update woocommerce_thumbnail_image_width 400
654
+ npx wp-env run cli wp media regenerate --yes
655
+ ```
656
+
657
+ | Azione | Impatto | Priorita |
658
+ |--------|---------|----------|
659
+ | Object Cache (Redis/Memcached) | Altissimo | 1 |
660
+ | HPOS (High Performance Order Storage) | Alto | 2 |
661
+ | CDN per immagini prodotto | Alto | 3 |
662
+ | Lazy loading immagini | Medio | 4 |
663
+ | Lookup tables WooCommerce | Alto | 5 |
664
+ | Disabilitare widget pesanti | Basso | 6 |
665
+
666
+ ---
667
+
668
+ ## 4. Checklist di Lancio
669
+
670
+ ### Prodotti e Catalogo
671
+ - [ ] Tutti i prodotti con titolo, descrizione, prezzo e immagini
672
+ - [ ] SKU univoci assegnati a ogni prodotto
673
+ - [ ] Categorie organizzate e assegnate
674
+ - [ ] Prodotti variabili con tutte le varianti configurate
675
+ - [ ] Inventario impostato (stock, low stock threshold)
676
+ - [ ] Peso e dimensioni per prodotti fisici
677
+ - [ ] Prodotti di test rimossi
678
+
679
+ ### Pagamenti
680
+ - [ ] Almeno un gateway attivo e testato
681
+ - [ ] Ordine di test completato con successo (Stripe test mode)
682
+ - [ ] Bonifico bancario con IBAN e istruzioni
683
+ - [ ] Contrassegno configurato (se offerto)
684
+ - [ ] Pagina conferma ordine visibile e corretta
685
+
686
+ ### Spedizioni
687
+ - [ ] Zone di spedizione configurate
688
+ - [ ] Tariffe corrette per ogni zona
689
+ - [ ] Soglia spedizione gratuita impostata
690
+ - [ ] Calcolo spedizione nel carrello funzionante
691
+
692
+ ### Tasse e Fiscalita
693
+ - [ ] IVA abilitata con aliquote corrette (22%, 10%, 4%)
694
+ - [ ] Prezzi visualizzati IVA inclusa (B2C Italia)
695
+ - [ ] Plugin fatturazione elettronica configurato
696
+ - [ ] P.IVA e dati aziendali nel footer e nelle fatture
697
+
698
+ ### Email
699
+ - [ ] WP Mail SMTP configurato
700
+ - [ ] Email nuovo ordine (admin) — testata
701
+ - [ ] Email ordine completato (cliente) — testata
702
+ - [ ] Email nuovo account (cliente) — testata
703
+ - [ ] Mittente personalizzato (non wordpress@)
704
+ - [ ] Template email con logo e colori brand
705
+
706
+ ### Legale e GDPR
707
+ - [ ] Privacy Policy pubblicata e linkata
708
+ - [ ] Termini e Condizioni di vendita
709
+ - [ ] Cookie Policy con banner consenso
710
+ - [ ] Checkbox consenso privacy al checkout
711
+ - [ ] Diritto di recesso (14 giorni — D.Lgs. 206/2005)
712
+ - [ ] Dati aziendali completi: ragione sociale, P.IVA, sede legale, PEC
713
+
714
+ ### Tecnico
715
+ - [ ] SSL attivo su tutto il sito
716
+ - [ ] Theme responsive su mobile/tablet/desktop
717
+ - [ ] Checkout mobile semplificato
718
+ - [ ] Favicon impostata
719
+ - [ ] Menu con link a Shop, Carrello, Account
720
+ - [ ] Redirect HTTP → HTTPS
721
+
722
+ ### Performance
723
+ - [ ] Immagini prodotto ottimizzate (WebP)
724
+ - [ ] Object cache attivo
725
+ - [ ] Page cache attivo (non su carrello/checkout/account)
726
+ - [ ] Lighthouse > 80 su pagina shop e prodotto
727
+
728
+ ### SEO
729
+ - [ ] Plugin SEO configurato
730
+ - [ ] Sitemap include prodotti e categorie
731
+ - [ ] Schema markup Product, Offer, Review
732
+ - [ ] Breadcrumb attivi
733
+ - [ ] Google Search Console e Merchant Center collegati
734
+
735
+ ### Sicurezza
736
+ - [ ] Password admin forte
737
+ - [ ] Backup automatico configurato
738
+ - [ ] Plugin aggiornati
739
+ - [ ] PCI DSS: nessun dato carta memorizzato localmente
740
+
741
+ ---
742
+
743
+ ## 5. Riferimenti
744
+
745
+ ### Skill del Plugin
746
+
747
+ | Skill | Quando usarla per e-commerce |
748
+ |-------|------------------------------|
749
+ | `wp-block-themes` | Sviluppo theme.json, templates shop, patterns |
750
+ | `wp-local-env` | Setup ambiente wp-env con WooCommerce |
751
+ | `wp-deploy` | Deploy in produzione con verifica pagamenti e SSL |
752
+ | `wp-performance` | Ottimizzazione catalogo, object cache, HPOS |
753
+ | `wp-plugin-development` | Custom product types, gateway, integrazioni |
754
+ | `wp-rest-api` | Headless commerce, integrazioni esterne, Store API |
755
+ | `wp-wpcli-and-ops` | Gestione prodotti, ordini, clienti via CLI |
756
+ | `wp-backup` | Backup database e file |
757
+ | `wp-audit` | Verifica sicurezza, SSL, GDPR compliance |
758
+ | `wp-content` | Gestione pagine legali, FAQ, contenuti shop |
759
+ | `wp-migrate` | Migrazione negozio tra ambienti |
760
+
761
+ ### Plugin Consigliati
762
+
763
+ | Plugin | Scopo | Alternativa |
764
+ |--------|-------|-------------|
765
+ | **WooCommerce** | Core e-commerce | — |
766
+ | **WooCommerce Payments** | Gateway Stripe integrato | Stripe for WooCommerce |
767
+ | **WP Mail SMTP** | Email transazionali | FluentSMTP |
768
+ | **WooCommerce PDF Invoices** | Fatture PDF | Fattureincloud integration |
769
+ | **Yoast WooCommerce SEO** | SEO prodotti | Rank Math |
770
+ | **Complianz** | GDPR cookie banner | Iubenda, CookieYes |
771
+ | **UpdraftPlus** | Backup automatici | BackWPup |
772
+ | **Redis Object Cache** | Object cache | — |
773
+ | **ShortPixel** | Ottimizzazione immagini | Imagify |
774
+
775
+ ### Risorse Esterne
776
+
777
+ - [WooCommerce Documentation](https://woocommerce.com/documentation/) — Documentazione ufficiale
778
+ - [WooCommerce REST API](https://woocommerce.github.io/woocommerce-rest-api-docs/) — Endpoint API
779
+ - [WooCommerce Hooks Reference](https://woocommerce.com/document/introduction-to-hooks-actions-and-filters/) — Action e filter hooks
780
+ - [WooCommerce Block Theme Guide](https://developer.woocommerce.com/docs/block-theme-development/) — Tema a blocchi
781
+ - [WP-CLI WooCommerce Commands](https://github.com/wp-cli/woocommerce-command) — Comandi CLI
782
+ - [Codice del Consumo (D.Lgs. 206/2005)](https://www.normattiva.it/uri-res/N2Ls?urn:nir:stato:decreto.legislativo:2005-09-06;206) — Normativa e-commerce Italia
783
+
784
+ ---
785
+
786
+ *Guida per il plugin [wordpress-manager](https://github.com/morrealev/wordpress-manager) v1.5.0+*