If you want to modify the PDF category or products layout for different categories you can use the following 2 filter:

  • woocommerce_pdf_catalog_category_layout
  • woocommerce_pdf_catalog_products_layout

Example how to modify the category layout:

function modify_pdf_category_layout( $layout, $category_id) {

	if($category_id == 18) {
		$layout = 2;
	}

    return $layout;
}
add_filter( 'woocommerce_pdf_catalog_category_layout', 'modify_pdf_category_layout', 10, 2 );

Example how to modify the products layout and do not touch the Full catalog layout:

function modify_pdf_products_layout( $layout, $category_id) {

	// Do not modify product layouts for full catalog
	if($_GET == "full") {
		return $layout;
	}

	// Change the product layout for category 18 (clothing) to Layout 2
	if($category_id == 18) {
		$layout = 1;
	}

	// Hoodies
	if($category_id == 19) {
		$layout = 2;
	}

    return $layout;
}
add_filter( 'woocommerce_pdf_catalog_products_layout', 'modify_pdf_products_layout', 10, 2 );

2 thoughts on “Modify PDF category or products layout

  1. Franck V. says:

    Hello,
    I’ve just your plugin and it looks to work as expected. I want to add some content in the product description that are stored in custom fields (ACF). Is there a way to do that ?
    Do I need to edit a php file of your plugin (which one?) or is there a hook ?
    Thanks

  2. Arafat says:

    how to move category title to the next page if no products under the category title (because the products has no space under the category title) so I end up with the category title in a page and the products in the next page, any help?

Leave a Reply

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