Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Product Subtitle on the PDF invoice

  • Resolved bitterandreal

    (@bitterandreal)


    Hi, I need to show the WooCommerce Product Subtitle on the PDF invoice and packing slip.

    I see the title is added like this <?php echo $item[‘name’]; ?> in invoice.php
    Is it possible to insert the subtitle in a similar way?

    The plugin developer says I should add the following filters but they make the invoice creation crash.
    woocommerce_order_item_name, woocommerce_order_item_quantity_html
    Could somebody please help me with this?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hi! Can you share the functions the Product Subtitles developer gave you for the filters woocommerce_order_item_name and woocommerce_order_item_quantity_html? That way we can debug them / try to find why they crash the invoice.

    Ewout

    He did not give me any further information.
    I tried it the same way like it is used in woocommerce/templates/cart/cart.php where the subtitle is displayed correctly.
    <?php echo apply_filters( ‘woocommerce_cart_item_name’, $_product->get_name(), $cart_item, $cart_item_key ) . ‘ ‘; ?>

    This is the subtitle plugin I’m using:
    https://wordpress.org/plugins/wc-product-subtitle/

    Plugin Author Ewout

    (@pomegranate)

    I see – the cart data is treated somewhat different than the order data.
    Unfortunately it’s not easy to re-use the filters they apply because of the way the Product Subtitles plugin is built up. But you can use their get_product_subtitle() or the_product_subtitle() functions:

    
    <?php the_product_subtitle( $item['product_id'] ); ?>
    

    Hope that helps!
    Ewout

    thank you very much. That works perfect!

    • This reply was modified 2 years, 7 months ago by bitterandreal.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Product Subtitle on the PDF invoice’ is closed to new replies.