Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Template duplication skips WooCommerce tables and never recreates them, so carts are lost on new sites

Aperta
#1,952 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php, sql
Ambito
backend, database

Direzione di ricerca

Start in inc/duplication/data.php, where Data::is_runtime_table() lists the WooCommerce tables that are skipped during template duplication, and read the docblock that says they are regenerated. Reproduce by duplicating a WooCommerce template site and checking whether the woocommerce_sessions table exists on the new blog. Done means the tables exist on the destination and a cart survives a page load, and you should first settle which of the two fixes the issue proposes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-maintainer-review review:approve

Version: Ultimate Multisite 2.17.2, WooCommerce, subdomain multisite

What happens:
Data::is_runtime_table() (inc/duplication/data.php) skips woocommerce_sessions, woocommerce_api_keys, woocommerce_downloadable_product_permissions and woocommerce_log when duplicating a template. The docblock says these tables “are regenerated on the destination site”, but nothing creates them. On the new site those four tables don’t exist at all.

Visible symptom: WooCommerce can’t save the session. A visitor adds a product and the mini-cart count updates from the AJAX response. On the next page load, /cart and /checkout are empty, and the Store API /wc/store/v1/cart returns no items even when the session cookie is sent. It happens in incognito and on any device. Nothing is logged on the front end.

Reproduce:

Duplicate a site that has WooCommerce active, using a template.
Check the DB for {prefix}{blog_id}_woocommerce_sessions. It’s missing.
Add a product to the cart, then request /cart with the same cookie. The cart is empty.

Suggested fix: skip the rows but keep the structure. For tables flagged as runtime-only, run CREATE TABLE IF NOT EXISTS LIKE instead of skipping them entirely. That keeps the intent (no copying of sessions, logs or queues) and avoids a missing-table problem for any plugin, not just WooCommerce. The same issue probably applies to other tables on that list, such as actionscheduler_, yoast_, redirection_* and litespeed_*, which some plugins expect to exist.

Alternative: after the data copy, switch to the new site and call WC_Install::create_tables() when WooCommerce is present.

Workaround we use: an mu-plugin that does the second option on mucd_after_copy_data.

Lingua principale
PHP
Stelle
218
Fork
87
Merge medio
1g 7h
PR unite (30g)
85

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Ultimate-Multisite/ultimate-multisite

Tutte le issue di Ultimate-Multisite/ultimate-multisite

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.