Skip to content

Instantly share code, notes, and snippets.

@DevWael
Created April 24, 2026 17:44
Show Gist options
  • Select an option

  • Save DevWael/5bb8b6cae17005d7fce9ee99eeb8a1d1 to your computer and use it in GitHub Desktop.

Select an option

Save DevWael/5bb8b6cae17005d7fce9ee99eeb8a1d1 to your computer and use it in GitHub Desktop.
Shortcode callback to render the YITH Request a Quote table
if ( ! function_exists( 'dw_ywraq_request_quote_popup' ) ) {
/**
* Shortcode callback to render the YITH Request a Quote table
* inside a popup/modal overlay context.
*
* Acts as a proxy to [yith_ywraq_request_quote], wrapping the
* quote list output in a dedicated popup container.
*
* Usage: [yith_ywraq_request_quote_popup]
*
* @param array $atts Shortcode attributes (unused; reserved for future extension).
* @param string $content Enclosed content (unused).
*
* @return string HTML output of the popup wrapper with the RAQ table inside.
*/
function dw_ywraq_request_quote_popup( $atts, $content = null ) {
// Bail early if the YITH plugin is not active.
if ( ! class_exists( 'YITH_Request_Quote' ) ) {
return '';
}
$atts = shortcode_atts(
array(),
$atts,
'yith_ywraq_request_quote_popup'
);
$raq_content = YITH_Request_Quote()->get_raq_return();
$args = array(
'raq_content' => $raq_content,
'template_part' => 'view',
);
$args['args'] = $args;
ob_start();
?>
<div class="dw-raq-popup-wrapper" id="dw-raq-popup">
<div class="dw-raq-popup-inner">
<?php wc_get_template( 'request-quote.php', $args, '', YITH_YWRAQ_TEMPLATE_PATH ); ?>
</div>
</div>
<?php
return ob_get_clean();
}
}
add_shortcode( 'yith_ywraq_request_quote_popup', 'dw_ywraq_request_quote_popup' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment