Adding a PDF catalog for your store

,

Like in a physical store, it could be useful in some cases to have a PDF catalog of your web store, free and available for everyone to download.

An example could be a wholesaler who wants to buy from you, but they will have different prices, so they need a specific catalog. Another example could be people who want to download the catalog, read it at home, and then buy, or to show it to a friend. It could be useful in many cases.

So, how do you add a PDF catalog to your store? With Store Catalog PDF Download.

Store Catalog PDF Download is a premium WooCommerce extension that creates automagically a catalog of your store and allows users to download it for free from the Shop archive pages and the single product pages.

It’s easy to configure, it only has a few options:

pdf-catalog-settings

You can read more about the configuration and the available options in the extension documentation.

It also includes templates for the generated PDF catalog, which you can override to customize it, or if you don’t need deep customizations, you can just use the available hooks to customize the PDF catalog.

Anyway, this is not a promo post for Store Catalog PDF Download. What I want to show you is something else.

By default this extension shows the PDF catalog download button on the single product page and on any products archive page (Shop page, product category pages and product tag pages). There aren’t options to remove them, or hooks, unfortunately, so when it comes to the first scenario I wrote about at the top of this post, where wholesalers would have a dedicated catalog with different prices, it could be tricky to achieve.

The good news is that we can hide the default buttons, and use the extension’s shortcode to show a custom button wherever we want!

Add this custom CSS to your website:

.wc-store-catalog-pdf-download-link {
    display: none;
}

If you don’t know how to add custom CSS to your site, read this article.

Now, by using the shortcode [wc-store-catalog-pdf] you can show a custom download button for your PDF catalog wherever shortcodes are allowed, in example, in a Text widget in the sidebar, or by using a hook and the function do_shortcode.

Here is an example snippet to show the button with the shortcode and a hook on the single product page, after the product meta:


add_action( 'woocommerce_single_product_summary', 'custom_pdf_catalog_download_button' );
function custom_pdf_catalog_download_button() {
return do_shortcode( '[wc-store-catalog-pdf]' );
}

view raw

functions.php

hosted with ❤ by GitHub

If you want to use this code, add it at the end of the file functions.php in wp-content/themes/your-child-theme-name/.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply