You can use this code to open instead of save
function child_theme_wc_cart_pdf_destination( $dest ) {
if ( class_exists( '\Mpdf\Output\Destination' ) ) {
$dest = \Mpdf\Output\Destination::INLINE;
}
return $dest;
}
add_filter( 'wc_cart_pdf_destination', 'child_theme_wc_cart_pdf_destination' );
Sorry that’s not the question. I have it set to INLINE but it does not open in a new tab… like target=”_blank”.
Did you change the button that triggers the PDF? By default it does open in new tab. Here is the code that renders the button which includes target=”_blank”
function wc_cart_pdf_button() {
if ( ! is_cart() || WC()->cart->is_empty() ) {
return;
}
?>
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'cart-pdf' => '1' ), wc_get_cart_url() ), 'cart-pdf' ) ); ?>" class="cart-pdf-button button" target="_blank">
<?php esc_html_e( get_option( 'wc_cart_pdf_button_label', __( 'Download Cart as PDF', 'wc-cart-pdf' ) ) ); ?>
</a>
<?php
}
add_action( 'woocommerce_proceed_to_checkout', 'wc_cart_pdf_button', 21 );
Ah… that works for my application. Thanks for the help!