David Jensen
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce Cart PDF] plugin does not work from last updateCould you mind trying this version of the plugin and let me know if it resolves the error?
Forum: Plugins
In reply to: [WooCommerce Cart PDF] plugin does not work from last updateHello
Do you happen to know what version of PHP you are using?
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Button not showing upDid you add the Cart PDF Button block to your cart and/or checkout? Here is a video showing how:
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Button not showing upYes do you know if that is the gutenberg block checkout or not? What theme are you using?
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Button not showing upAre you using the WooCommerce checkout blocks?
If so you have to edit the checkout block either in your checkout page or site editor (wherever you have the checkout blocks) and add the custom block this plugin provides “Cart PDF Button”.
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Button not showing upHello
Can you check if you have your Cart page specified in the WooCommerce settings?
/wp-admin/admin.php?page=wc-settings&tab=advanced
WooCommerce > Settings > Advanced > Page setup
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Button not workingHello
Can you check if you have your Cart page specified in the WooCommerce settings?
/wp-admin/admin.php?page=wc-settings&tab=advanced
WooCommerce > Settings > Advanced > Page setup
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Archive page with generated pdf’sHello
The PDFs are not stored in the database or on the server, they are generated in real-time.
You can create this feature though by registering a new post type that has an archive, and then creating a post and saving the PDF to the filesystem and storing it as post meta. Below is an example, assuming you have a registered post type with the slug of
pdf
/**
* Save the PDF
*
* @param \Mpdf\Mpdf $mpdf Mpdf object.
* @return void
*/
function wc_cart_pdf_save_pdf_to_database( $mpdf ) {
// Get the WordPress upload directory
$upload_dir = wp_upload_dir();
$upload_path = $upload_dir['basedir'] . '/wc-cart-pdf/';
// Ensure the directory exists
if ( ! file_exists( $upload_path ) ) {
wp_mkdir_p( $upload_path );
}
// Construct the file path
$file_name = apply_filters( 'wc_cart_pdf_filename', 'WC_Cart-' . gmdate( 'Ymd' ) . bin2hex( openssl_random_pseudo_bytes( 5 ) ) ) . '.pdf';
$file_path = $upload_path . $file_name;
// Output the PDF to the specified path
$mpdf->Output( $file_path, 'F' );
// Insert a new post of type 'pdf'
$post_data = array(
'post_title' => wp_strip_all_tags( $file_name ), // Use the file name as the post title
'post_content' => '', // You can add content if needed
'post_status' => 'publish', // Or 'draft' if you don't want it to be published immediately
'post_type' => 'pdf', // You can use any post type you want
);
// Insert the post into the database
$post_id = wp_insert_post( $post_data );
// Optionally, store the file path or URL in post meta if needed
if ( ! is_wp_error( $post_id ) ) {
$file_url = $upload_dir['baseurl'] . '/wc-cart-pdf/' . $file_name;
update_post_meta( $post_id, '_pdf_file_url', $file_url ); // Save the URL of the PDF in post meta
}
}
add_action( 'wc_cart_pdf_output', 'wc_cart_pdf_save_pdf_to_database' );Forum: Plugins
In reply to: [WooCommerce Cart PDF] Change E-Mail subject and bodyHello
There are filters you can use for this:
add_filter( 'wc_cart_pdf_email_copy_subject', function( $subject ) {
return 'your custom subject';
} );add_filter( 'wc_cart_pdf_email_copy_body', function( $subject ) {
return 'your body here';
} );Here is the code that sends the admin email, you can use this to create your own email to send elsewhere if you’d like:
https://github.com/dkjensen/wc-cart-pdf/blob/master/includes/modules/copy-admin.php
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo updateAnd thank you for bringing this issue to my attention ??
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo update@ecros Awesome glad to hear that! I will release an official update here tomorrow but in the meantime feel free to use the version I sent.
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo update@ecros Would you mind trying uploading this version of WC Cart PDF plugin on your staging environment and let me know if it fixes the issue for you?
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo update@ecros Are you able to check if there are theme updates available and if so, update the theme?
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo update@ecros Those errors are unrelated to the WC Cart PDF plugin. The errors in WooCommerce > status > logs are related to this plugin.
You could edit your wp-config.php file and add/modify the following:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
Which will display the errors on the screen instead of giving you the There has been a critical error on this website notice, however other errors might display on other pages of your site so this may not be the best solution on a production site.
Your hosting provider should have some sort of interface to view all errors, what I would do is trigger the error, then immediately refresh and open the logs, it should be one of the most recent error entries in your log, that way you do not have to fish through so many unrelevant errors.
Forum: Plugins
In reply to: [WooCommerce Cart PDF] Plugin no longer works after Woo update@ecros Are you able to look at your site error logs and paste in the error you are seeing?