• Resolved reign1

    (@reign1)


    Hi,

    Is there a way to alter packing slip template (or create a custom one) via dashboard interface? If not what files should I modify to design my own?

    BR,
    Gytis

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Gytis,
    We have a page in our documentation with instructions on how to create a custom template: https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/creating-a-custom-pdf-template/

    Additionally, we offer the Premium Templates extension that has an interface to easily add column/total rows with additional price and product information, and the possibility to add custom blocks of text/order data in various predefined locations in the template (+2 additional base layouts).
    If you have more questions about this, please send an email to support@wpovernight.com, as www.ads-software.com does not allow us to use these forums for supporting our paid extensions.

    Thread Starter reign1

    (@reign1)

    Hi @pomegranate ,

    Thanks for the input. Got a quick one. I’ve altered invoice file (/domains/moon-mood.lt/public_html/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple) and added a custom field (created with https://www.ads-software.com/plugins/advanced-custom-fields/) right below payment method:

    <tr class="siuntos-numeris">
    <th><?php _e( 'Siuntos numeris:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    <td><b><?php the_field('siuntos_numeris'); ?></b></td>
    </tr>

    It’s a shipment tracking number field which is being entered when order status is being changed from processing to done. Somehow generated invoice doesn’t pass the variable:

    https://ibb.co/25r4GGM

    But if I change order status from done to processing and then change to done again then I get invoice with shipment number:

    https://ibb.co/sV0bvKw

    Any idea what’s wrong? Is it that initially invoice is being generated before variable is passed or why do I need to have status switched back and forth so that shipment tracking id variable would reflect in pdf? Thanks!

    BR,
    Gytis

    Plugin Contributor Ewout

    (@pomegranate)

    you can only use the_field() in a context where a global post_id is set. that is not the case here. I recommend either using the internal functions (per the docs), or passing the $order_id (check this thread).

    p.s. You mentioned you altered the plugin file, this will be overwritten by plugin updates. You’ll save yourself headaches by following the instructions I posted in my first response above ??

    Thread Starter reign1

    (@reign1)

    Hi @pomegranate ,

    As per the thread
    the_field('siuntos_numeris');
    and
    the_field('siuntos_numeris', $order->get_id());
    worked the same way.

    It turns out when I input tracking id and update order without changing status and then change status to complete tracking id is passed to the invoice pdf so that issue is solved. Could you also let me know how to get order status within invoice?

    WooCommerce plugin support said I should get order status with
    $status = $order->get_status(); return $status;
    but when I tried it within your invoice.php it brings nothing

    <tr class="payment-method">
    <th><?php _e( 'Siuntos statusas:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    <td><?php $status = $order->get_status(); return $status; ?></td>
    </tr>

    Any ideas?

    BR,
    Gytis

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Gytis,
    The version without $order->get_id() may work in some contexts, but not all, so it is not reliable enough here so I recommend always including it regardless.

    
    $status = $order->get_status(); return $status;
    

    is simply a script to return the status, it doesn’t print anything (which would require echo instead of return).

    We can’t provide custom coding support for the free plugin, if you need more help with basic questions like these I recommend hiring a PHP developer to help you forward with the project.

    Good luck!

    Thread Starter reign1

    (@reign1)

    Hi @pomegranate ,

    Thanks for all the help, it worked like a charm. We can close this one.

    BR,
    Gytis

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Packing slip template’ is closed to new replies.