• Resolved theaccentshop

    (@theaccentshop)


    I had this code working few updates ago. It displays product attribute called “manufacturer” on the invoice. Now, the invoice show up with white background and black text only. I think the code might be outdated. Any suggestions?

    </dt><dt><?php $wpo_wcpdf->product_attribute(‘manufacturer’, $item[‘product’]); ?></dt>

    https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/

    Edit: The problem was due to the deletion of the product from my inventory. Causing the PDF invoice to display nothing but plain text. Is there a way to avoid this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter theaccentshop

    (@theaccentshop)

    Sorry, the custom code is:
    <?php $wpo_wcpdf->product_attribute(‘manufacturer’, $item[‘product’]); ?>

    Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    You can add a check to prevent removed products from breaking this:

    <?php if (!empty($item['product'])) $wpo_wcpdf->product_attribute('manufacturer', $item['product']); ?>

    Hope that helps!
    Ewout

    Thread Starter theaccentshop

    (@theaccentshop)

    Wonderful, that’s what I needed.
    I just need to add the sentence “Manufacturer Number:” inside the bracket somewhere.
    Thank you

    Thread Starter theaccentshop

    (@theaccentshop)

    Manufacturer Number: still shows up when field is empty as of now

    <dl><dt>Manufacturer Number: </dt><dt><?php if (!empty($item[‘product’])) $wpo_wcpdf->product_attribute(‘manufacturer’, $item[‘product’]); ?></dt></dl>

    Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    This is basic PHP, but here goes:

    <?php if (!empty($item['product'])) : ?>
    <dl><dt>Manufacturer Number: </dt><dt><?php $wpo_wcpdf->product_attribute('manufacturer', $item['product']); ?></dt></dl>
    <?php endif; ?>

    Hope that helps!
    Ewout

    Thread Starter theaccentshop

    (@theaccentshop)

    Thank you for the great help!
    PHP is not my strongest points 🙁

    Plugin Contributor Ewout

    (@pomegranate)

    You’re welcome, glad I could help 🙂

    Ewout

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Edit: Display attributes on invoice’ is closed to new replies.