WooCommerce: Add a free download for all your customers in their account

Do you want to have a detail with the customers of your online store? Or maybe you want them to always have your catalog at hand in their account?

A touch of customization for your Ecommerce can be to offer your customers a free download that is always available on their user account page, by default.

This trick is very easy to apply, just create a code like the following…

%MINIFYHTMLe726deed146778032109bb74ccb1cccb52%
/* Download by default in all accounts */ add_filter( 'woocommerce_customer_get_downloadable_products', 'wphelp_free_download', 9999, 1 ); function wphelp_free_download( $downloads ) { $downloads[] = array( 'product_name' => 'Download description', 'download_name' => 'Button tag', 'download_url' => 'https://mywoostore.com/wp-content/uploads/name-of-file.pdf', ); return $downloads; }

Of course, you have to customize it, in particular the following lines:

'product_name' => 'Download description', 'download_name' => 'Button tag', 'download_url' => '/wp-content/uploads/name-of-file.pdf',

It could be something like that, for example:

/* Download by default in all accounts */ add_filter( 'woocommerce_customer_get_downloadable_products', 'wphelp_free_download', 9999, 1 ); function wphelp_free_download( $downloads ) { $downloads[] = array( 'product_name' => 'catalogue 2020/21', 'download_name' => 'Download', 'download_url' => 'https://mywoostore.com/wp-content/uploads/2020/04/catalogue.pdf', ); return $downloads; }

Once you have customized it you can add the code at the end of the functions.php file (before ?> if there is) of the active theme or to your customizations plugin if you have it.

When you save the changes, the next time your customers go through the download section of their account they will see this change.

And they will always have available your catalog, manual, digital gift, whatever you want.

Read this post in Spanish: WooCommerce: Añade una descarga gratuita para todos tus clientes en su cuenta

Click to rate this post!
[Total: 0 Average: 0]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content