Developer notes
| Table | Content |
|---|---|
kv_gr_registries |
One row per registry: owner user_id, co_owner_email, type, title, owner_names, event_date (midnight, shop time zone), privacy P / L / W, password_hash (password_hash()), access_key (link key), status A / C / D, shipping address s_*, ship_to_owner, storefront_id, company_id (Ultimate storefront), reminder flags. |
kv_gr_items |
Products of a registry: product_id, selected options (JSON) + options_key, qty_wanted, priority 1 to 3, note, company_id of the product (Multi-Vendor). |
kv_gr_purchases |
One row per order line bought from a registry (UNIQUE order_id + cart_item_id): qty, state H held (Incomplete order, 1 hour), R reserved (open), P purchased (paid), V void. |
kv_gr_orders |
Order meta: registry, ship_to_owner, gift_message, from_name. Written per order (Multi-Vendor child orders included). |
kv_gr_throttle |
Fixed-window rate limit buckets (hashed visitor key). |
Cart and orders
Section titled “Cart and orders”- A registry line carries
extra.kv_gr = {registry_id, item_id, sig};sigis an HMAC (store secret instorage_datakv_gr_secret) over registry, item and product, set only by the add-on’s own add-to-cart path. The core copies requestproduct_data[..][extra]into cart lines, soPurchases::ref()ignores unsigned or altered references,calculate_cart_itemsstrips them andpre_place_orderrefuses them; the line options must also match the options of the registry item; thegenerate_cart_idhook keeps it apart from the same product bought for oneself. Sessioncart.kv_grholds the ship choice, the gift message and the from line. pre_place_order: customers only (not for Multi-Vendor child orders, the parent placement of the same cart was checked), re-checks registry status, storefront scope, options and quantities under the named lockkvgr_<db>_<prefix>place(released inplace_orderor at shutdown), prepares the registrant address.calculate_cart_items/calculate_cart_post: the registrants_*fields are put intocart.user_datafor the calculation and the buyer’s values are restored afterwards.create_order: the new order gets the registrants_*fields and a staff note indetails.place_order: order meta and purchase lines are written for every new order (also for Incomplete orders of online payments, which get no status change from the core).change_order_status_postmoves the lines; parent orders (is_parent_order = Y) are skipped.get_order_info: while a mask is on, the registrant street lines are replaced by “Address kept private”. The mask is on for storefrontorders.*andcheckout.complete, and while a customer-area e-mail about such an order is built (mailer_create_message_beforearea C, off again inmailer_send_post, the next message orchange_order_status_post). Admin, vendor and payment steps never mask.
Hooks used
Section titled “Hooks used”generate_cart_id, calculate_cart_items, calculate_cart_post, pre_place_order, create_order, place_order, change_order_status_post, delete_order, get_order_info, mailer_create_message_before, mailer_send_post, delete_product_post, post_delete_user, before_dispatch (admin cron fallback). All exist with the same arguments in 4.17.2 and 4.21.2.
Template hooks (storefront): products:buy_now (button, product page only), profiles:my_account_menu, checkout:extra_list (cart), checkout:final_section_customer_notes (checkout), orders:info, index:meta (noindex on registry pages). Admin: orders:detailed_after_content.
Schemas
Section titled “Schemas”promotions/schema.post.php: conditionkv_gr_completion(statement, cart zone,fn_kv_gift_registry_promo_completion).security/csrf_validation.post.php: every storefront POST ofgift_registryneeds the form security hash.permissions/admin.post.php: privilegesview_gift_registries,manage_gift_registries;vendor_multivendor.post.php: vendors only reachgift_registry.purchases(scoped byruntime.company_id).gdpr/user_data.post.php: owner registries and buyer purchase data for the core export and anonymization.block_manager/blocks.post.php: blockkv_gift_registry_finder.
Gift Wrap & Gift Messages bridge
Section titled “Gift Wrap & Gift Messages bridge”GiftWrap::active() checks addons.kv_gift_wrap_messages.status = A and class_exists('\Tygh\Addons\KvGiftWrapMessages\Orders'); GiftWrap::forOrder($order_id) reads its message, sender and wrap names. Nothing else depends on it.
Storefront URLs
Section titled “Storefront URLs”gift_registry.search?q=&type=&month=YYYY-MMgift_registry.view?registry_id=N[&key=K]gift_registry.manage,gift_registry.update[?registry_id=N],gift_registry.items?registry_id=N,gift_registry.thanks?registry_id=N,gift_registry.export?registry_id=N
php admin.php --dispatch=gift_registry.cron (console) or index.php?dispatch=gift_registry.cron&key=<cron key>. One pass sends due reminders and after-event e-mails (claimed with a conditional UPDATE, never twice) and clears old rate limit buckets.
tests/cli/e2e.php (inside a dev store), tests/e2e/e2e.mjs (HTTP: guest, owner, co-owner, buyer, admin, vendor), tests/cli/lifecycle.php (self-repair after an in-place update).