Developer guide
Add the button to custom cards, open quick view from code, run your scripts inside the modal, and override its templates.
Architecture
| Free | Pro | |
|---|---|---|
| Namespace | Siteryn\SiterynQuickView | SiterynPro\SiterynQuickView |
| Boot | plugins_loaded, then siteryn_qv_loaded | On siteryn_qv_loaded, then siteryn_qv_pro_loaded |
| Handles | siteryn-qv (CSS and JS) | siteryn-qv-pro |
| Settings option | siteryn_qv_settings | siteryn_qv_pro_settings |
Themes load after siteryn_qv_loaded has fired: hook init from a theme instead.
Template tag
<?php siteryn_qv_button(); ?> // current product in the loop <?php siteryn_qv_button( 123 ); ?> // a specific product <?php echo siteryn_qv_get_button( 123 ); ?> // return instead of echo
It uses the Button settings, loads the assets and modal, and ignores the "Where to Show" toggles. To reuse an action your theme's cards already fire, register it (before init priority 20):
add_filter( 'siteryn_qv_card_hooks', function ( $hooks ) {
return $hooks + array( 'mytheme_card_actions' => 20 );
} );
Opening quick view from code
Any element with data-siteryn-qv-product-id opens the modal, including elements added later:
<a href="<?php the_permalink(); ?>" data-siteryn-qv-product-id="123">Quick look</a>
window.siterynQuickView.open( 123, triggerElement ); // triggerElement gets focus back on close window.siterynQuickView.close();
Pass the parent product ID, not a variation ID. The modal exists only on pages where quick view loaded: shop, categories, product pages, cart and search, or pages that rendered a button. Force it elsewhere:
add_filter( 'siteryn_qv_enqueue_early', function ( $early ) {
return $early || is_front_page() || is_page( 'catalog' );
} );
JavaScript events
Each event fires as a jQuery event on document.body ((event, detail)) and as a CustomEvent on document (event.detail).
| Event | detail | When |
|---|---|---|
siteryn_qv_opened | productId, modal | The modal opens from closed, before content loads |
siteryn_qv_loaded | productId, modal, body | After each product renders (also from cache and when switching products), after WooCommerce's variation form is initialised |
siteryn_qv_added_to_cart | productId, fragments, cartHash | After an add to cart; WooCommerce's added_to_cart also fires |
siteryn_qv_closed | productId, modal | On close |
jQuery( document.body ).on( 'siteryn_qv_loaded', function ( event, detail ) {
jQuery( detail.body ).find( '.variations_form' ).trigger( 'my_swatches_init' );
jQuery( detail.body ).find( '.my-wishlist-btn' ).myWishlist();
} );
Products loaded with AJAX
The click handler is delegated, so buttons inside HTML added by infinite scroll or filters work. On themes whose custom cards rely on the automatic placement, newly loaded cards don't get a button (their buttons are printed in the page footer only for cards on the first load): print siteryn_qv_get_button() inside the card template instead. Theme icon bars on new cards are detected again automatically.
Templates
| Template | Variables | Keep |
|---|---|---|
button.php | $product, $settings, $text, $classes, $icon_html, $icon_position, $aria_label | data-siteryn-qv-product-id |
modal.php | $settings, $classes, $close_icon | Every data-siteryn-qv-* attribute |
quick-view.php | $product, $settings, $show_media | The product wrapper and .images column |
Copy them to your-theme/siteryn-quick-view/. Keep the @version header: outdated copies trigger an admin notice. Most changes are easier with the content hooks.
Endpoints
| Action | Access | Use |
|---|---|---|
siteryn_qv_get_product | Public, GET, no nonce (cache-safe) | product_id, lang → {html, productId, titleId} |
siteryn_qv_add_to_cart | Public, POST, nonce siteryn_qv_add_to_cart | product_id, quantity, variation_id, attribute_* → {fragments, cartHash, productName, cartUrl} |
siteryn_qv_save_settings · siteryn_qv_reset_settings (admin-post) · siteryn_qv_pro_license_action | manage_woocommerce + nonce | Settings screen |
The Plugins screen's deactivation survey posts to siteryn_deactivation_feedback (activate_plugins + nonce). No REST routes or blocks. Free has no shortcode; Pro has [siteryn_quick_view].
Data
- Options:
siteryn_qv_settings,siteryn_qv_version,siteryn_qv_pro_settings,siteryn_qv_pro_version,siteryn_license_quick-view_key/_status/_update. - Transient
siteryn_qv_outdated_templates(1 day). No post meta, tables, cron or custom capabilities. - Uninstalling removes each plugin's own options.
wp-config constants
| Constant | Effect |
|---|---|
SCRIPT_DEBUG | Unminified CSS |
SITERYN_FEEDBACK_ENDPOINT | Where the deactivation survey is sent (default https://siteryn.com/wp-json/siteryn/v1/feedback/deactivation) |
SITERYN_QV_PRO_LICENSE_API_BASE | License server URL (default https://siteryn.com/wp-json/siteryn/v1) |