To send your terms of sale as a PDF with every order confirmation, all you need is a short snippet that attaches the file to the WooCommerce e-mail of your choice. Your customer then keeps the terms in force on the day of purchase. It is also a simple way to give them, on a durable medium, the information the law requires after a distance sale.
In short
- After a distance sale, the customer must receive a confirmation of the contract on a durable medium (Article L221-13 of the French Consumer Code).
- This confirmation repeats the pre-contractual information and comes with the model withdrawal form.
- An e-mail with your terms of sale and the form as PDFs is a simple way to meet this.
- The code below attaches one or more PDFs to the e-mail you choose.
- Keep every version of your terms of sale: it proves what the customer accepted.
What the law says
Article L221-13 of the French Consumer Code (Code de la consommation) requires distance sellers to give the customer a confirmation of the contract on a durable medium:
- within a reasonable time after the order, and at the latest on delivery of the goods;
- with all the pre-contractual information set out in Article L221-5, unless it was already given on a durable medium;
- together with the model withdrawal form.
A durable medium lets the customer keep the information and find it unchanged later. A web page you can edit at any time does not do that. An e-mail with the documents as PDFs is the most common way to do it.
The “I have read and agree to the website terms and conditions” checkbox is still essential at checkout: WooCommerce shows it as soon as a terms page is set in its settings. The PDF comes on top: the customer accepts, then receives the document.
The method, in three steps
1. Put your PDFs in the media library
Upload your terms of sale as a PDF, and the model withdrawal form, in Media > Add New Media File. Open each file and note its ID: it is the number after item= or post= in the page address.
2. Add the code
Add this code with a plugin such as Code Snippets, or in your child theme’s functions.php file. Replace 123 and 124 with the IDs of your files:
add_filter( 'woocommerce_email_attachments', 'wycan_joindre_cgv', 10, 4 );
function wycan_joindre_cgv( $attachments, $email_id, $object, $email = null ) {
$emails_concernes = array( 'customer_processing_order', 'customer_on_hold_order' );
$fichiers = array( 123, 124 );
if ( ! in_array( $email_id, $emails_concernes, true ) ) {
return $attachments;
}
foreach ( $fichiers as $fichier_id ) {
$chemin = get_attached_file( $fichier_id );
if ( $chemin && file_exists( $chemin ) ) {
$attachments[] = $chemin;
}
}
return $attachments;
}3. Choose the e-mails
The code attaches the files to the e-mails listed in $emails_concernes. By default: the “Processing” order (paid) and the “On hold” order (bank transfer or check still to come), so every customer receives the documents whatever their payment method. The IDs of the main customer e-mails:
customer_on_hold_order: order on hold;customer_processing_order: processing order;customer_completed_order: completed order;customer_invoice: order details, sent manually from the admin;customer_refunded_order: refunded order;customer_note: note added to the order.
Then place a test order and check that both PDFs arrive as attachments.
When you change your terms of sale
- Upload the new version to the media library under a dated name (for example
terms-2026-10.pdf). - Replace the ID in the code.
- Do not delete the old version: it proves what customers who ordered before the change accepted.
- Update the terms page of the site too, so that both say the same thing.
What about withdrawing online?
Since 19 June 2026, the model form is no longer enough: a shop must also offer a button to withdraw online. We explain everything in our guide to the WooCommerce withdrawal button.
Need help?
We can set up the sending of your documents and check your order e-mails and your shop’s buying journey.
This article is for information only and is not legal advice. The wording of your terms of sale should be approved by a legal professional.



