Hi @robbyprincesstraveller,
I just updated the code:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Save the PDF invoice link for guest access in the order data
*
* Options required:
* - "Document link access type" set as "Full"
*/
add_action( 'wpo_wcpdf_before_document', function( $document_type, $order ) {
if ( ! empty( $order ) && 'invoice' === $document_type ) {
$debug_settings = get_option( 'wpo_wcpdf_settings_debug', array() );
if( isset( $debug_settings['document_link_access_type'] ) && 'full' === $debug_settings['document_link_access_type'] ) {
$pdf_url = WPO_WCPDF()->endpoint->get_document_link( $order, $document_type );
// Save the PDF invoice link under the 'wcpdf_document_link' meta key
$order->update_meta_data( 'wcpdf_document_link', $pdf_url );
$order->save();
}
}
}, 10, 2 );
Could you please try the code above and confirm whether it worked, or not?
@yordansoares thanks for the update. The code worked great!
Thanks for confirming that it worked, @robbyprincesstraveller!
If you don’t mind and have the time, do you think you could leave us a review?
Thanks in advance and all the best with your store!