Add-on cannot not work with WooCommerce

QuestionsCategory: PDF Light ViewerAdd-on cannot not work with WooCommerce
AvatarKelvin Lee asked 2 years ago

Dear Sir/Madam,
I got 404 Error when I submit with only me and admin status.
I install the PDF Light Viewer Plugin Pro to my site with WooCommerce.
PDF can be rendered if adding shortcode in page http://brilliant.bs4.work/e-book/
I insert Viewer into WooCommerce Tabs with below code

add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
function woo_new_product_tab( $tabs ) {
// Adds preview subscription tab
$tabs[‘test_tab’] = array(
‘title’ => __( ‘Preview’, ‘woocommerce’ ),
‘priority’ => 50,
‘callback’ => ‘woo_preview_subscription_tab_content’
);
return $tabs;
}
function woo_preview_subscription_tab_content() {

global $wpdb;
$posttitle = ‘WR150’;
$postid = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_title = ‘” . $posttitle . “‘” );
echo PdfLightViewer_FrontController::display_pdf_book(array(‘id’ => $postid));
}

Problem output can be found http://screencloud.net/v/s890 and http://screencloud.net/v/46O3 from  I am sure the PDF (post id 2079) is existed. What is the problem the Viewer cannot be viewed properly?
Best regards,
Kelvin

1 Answers
supportsupport answered 2 years ago

Hello Kelvin,
Let’s continue discussion in the https://support.wp.teamlead.pw/q/add-on-cannot-not-work-with-woocommerce/