Gatemi Purchase Lists Developer Reference

Shared between the editions

Item Name
Lists table {prefix}gmpl_lists — id, user_id, title, share_key (unique), is_default, created_at
Lines table {prefix}gmpl_items — id, list_id, product_id, variation_id, quantity, added_at; unique key list_line (list_id, product_id, variation_id)
Settings option gmpl_settings
My Account endpoint purchase-lists (menu label "Purchase list" in the free edition, "Purchase lists" in the full edition)
Shortcode [gatemi_purchase_list] — renders the same page anywhere
Form nonce action gmpl_action, field gmpl_nonce
Rewrite marker option gmplf_endpoint_added (free) / gmpl_endpoint_added (full) — the endpoint's rules are flushed once, when it differs from the endpoint

Adding a line is one statement:

INSERT INTO {prefix}gmpl_items (list_id, product_id, variation_id, quantity, added_at)
VALUES (…) ON DUPLICATE KEY UPDATE quantity = quantity + VALUES(quantity)

Form actions

All actions are POSTs to the current page, handled on template_redirect at priority 5, with the nonce above and a signed-in user, and answered with a redirect back to the same page (so a refresh never re-posts). The one exception is Full edition to_cart with gmpl_share (the share key) instead of gmpl_list: it fills the visitor's own cart from a shared list and needs no sign-in. On a variable product add must carry a gmpl_variation that is one of its variations; the parent alone is refused. The action is the gmpl_action field:

gmpl_action Fields Edition
add gmpl_product, optional gmpl_variation, gmpl_quantity both (gmpl_list in the full edition)
update gmpl_qty[product:variation] = n (0 removes) both
to_cart — (gmpl_list in the full edition, or gmpl_share for a shared list) both
reorder gmpl_order both
rename_list gmpl_title (and gmpl_list) both
remove, create_list, delete_list, bulk_add (gmpl_paste) Full edition

A form of your own can post these. For example a "Save to my list" button for a specific variation:

<form method="post">
	<?php wp_nonce_field( 'gmpl_action', 'gmpl_nonce' ); ?>
	<input type="hidden" name="gmpl_product" value="123" />
	<input type="hidden" name="gmpl_variation" value="456" />
	<button type="submit" name="gmpl_action" value="add">Save this size</button>
</form>

WooCommerce hooks used

  • woocommerce_single_product_summary (35) — the add button.
  • woocommerce_my_account_my_orders_actions — the Order again action (key gmpl_reorder, links to the order).
  • woocommerce_order_details_after_order_table — Order all of this again.
  • deleted_user (free edition) — removes the user's lists.

Free edition

The free edition applies no filters or actions of its own. Its schema marker is gmplf_db_version; its stylesheet handle is gmplf-lists.

CSS classes: .gmplf-list, .gmplf-list-title, .gmplf-table, .gmplf-row, .gmplf-cell-name, .gmplf-cell-price, .gmplf-cell-qty, .gmplf-qty, .gmplf-oos, .gmplf-actions, .gmplf-to-cart, .gmplf-update, .gmplf-rename, .gmplf-empty, .gmplf-add, .gmplf-button, .gmplf-button--saved, .gmplf-button--login, .gmplf-reorder, .gmplf-reorder-button, .gmplf-reorder-note. Buttons also carry WooCommerce's button and the block-theme wp-element-button classes.

Full edition

Filters

Filter Arguments Default Purpose
gmpl_settings $settings — The merged settings array
gmpl_max_lists $max 20 Lists one customer may keep
gmpl_buy_again_limit $limit 8 Products the buy-again panel shows
gmpl_share_url $url, $list endpoint + ?gmpl_share=key The share link
gmpl_modules $modules — Module list booted
gmpl_license_api_url $url gatemi.com Licence API (staging)
gmpl_update_cache_ttl $seconds — Update payload cache
// Allow 50 lists per trade customer.
add_filter( 'gmpl_max_lists', fn() => 50 );

Actions

gmpl_booted — after every module has booted; receives the service container.

Other storage

Item Name
Schema marker gmpl_db_version
Licence gmpl_license
Update cache transient gmpl_update_payload
Cron gmpl_license_check (twice daily, only with a key)
Object cache group gmpl_lists
Share query arg gmpl_share

CSS classes

.gmpl-list (with data-gmpl-list), .gmpl-list-title, .gmpl-table, .gmpl-row, .gmpl-cell-name, .gmpl-cell-price, .gmpl-cell-qty, .gmpl-qty, .gmpl-oos, .gmpl-actions, .gmpl-to-cart, .gmpl-update, .gmpl-tools, .gmpl-rename, .gmpl-delete, .gmpl-share, .gmpl-share-url, .gmpl-new-list, .gmpl-bulk, .gmpl-bulk-help, .gmpl-paste, .gmpl-buy-again, .gmpl-buy-again-items, .gmpl-buy-again-item, .gmpl-buy-again-name, .gmpl-empty, and on the product page .gmpl-add, .gmpl-add-list, .gmpl-button, .gmpl-button--saved, .gmpl-button--login, .gmpl-reorder-button.

The two editions use different class prefixes (gmplf- and gmpl-), so CSS written for one needs both selectors if you may switch editions.

Shopping Cart
Scroll to Top