My Account PDF Link function with WPML
-
Hello,
I have the latest WP with latest WooCommerce and latest WPML.
On the My Account page, the default plugin places Download PDF links to the main domain of the website (the WPML’s main language domain). This link does not work as the current user’s login session is connected to the current language domain.
Whenever I copy the URL of the PDF Download link (lets say this is a .com link), and change the .com to the current language domain extension (.nl for example), then the PDF loads fine and can be downloaded/printed.
Now, I’ve came up with a temporary solution for this, by editing class-wcpdf-writepanels.php in the Plugin’s includes folder.
I changed the function my_account_pdf_link to this:
=========================================
if (ICL_LANGUAGE_CODE==’en’) {$currentlangadmindomain=’https://www.mydomain.co.uk/wp-admin/’;}
if (ICL_LANGUAGE_CODE==’nl’) {$currentlangadmindomain=’https://www.mydomain.nl/wp-admin/’;}
if (ICL_LANGUAGE_CODE==’de’) {$currentlangadmindomain=’https://www.mydomain.de/wp-admin/’;}
$pdf_url = wp_nonce_url( $currentlangadmindomain. ( ‘admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=’ . $order->id . ‘&my-account’), ‘generate_wpo_wcpdf’ );
=========================================How can I add this to my theme’s functions.php or something so I can keep updating your plugin without having to edit this every update?
Thank you very much.
https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/
The topic ‘My Account PDF Link function with WPML’ is closed to new replies.