• Resolved sofiahz

    (@sofiahz)


    Hi,

    I just updated the plugin and now the location is no longer in the packing slips. Anybody know what might have happend and how to get it back? I cannot find any settings where to add this. They are still in the order summary in woocommerce.

    It tried to revert to an earlier version but did not help.

    Thank you!

    Sofia

    • This topic was modified 2 months, 2 weeks ago by sofiahz.

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

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

    (@yordansoares)

    Hi @sofiahz,

    We haven’t applied any change in the packing slip settings.

    Are you maybe adding the location with custom code? If so, please note that if you were applying that customization in the plugin’s files, these will always be overridden in every update!

    Instead of editing the plugin core, if you have PHP skills you can use a custom PDF template or the PDF template action hooks (recommended)

    If you prefer to use a visual drag & drop editor to display custom fields or extra content, then you could use the customizer included in the PDF Invoices and Packing Slips Plus Bundle, since it do not require coding skills and is easy to use 😉

    Thread Starter sofiahz

    (@sofiahz)

    Hi,

    No I did not add any code I belive since I have no idea where to add a code, cannot find a place to add extra code. I unfortunately dont have good php skills and the customer does not want to pay for the pro version.

    I will have to continue to google then. So strange we had it before but not after the update.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @sofiahz,

    I can’t tell you what could be happening, as we do not show custom fields by default, but if you provide me more details about the location field, e.g. which plugin you are using to handle this, I can try to help you to display the location in the packing slip again.

    Thread Starter sofiahz

    (@sofiahz)

    Hi! I am using ATUM for the locations. It show in the order details on woocommerce. I have tried some codes now but none of them works unfortunately. This is the last one I tried. With this one I get an error in the php function file. The other I tried no error but nothing shows up.


    <?php add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_atum_location', 10, 2 );
    function wpo_wcpdf_atum_location($template_type, $order) {
    if ($template_type == 'packing-slip') {
    $document = wcpdf_get_document( $template_type, $order );

    $atum_location = get_post_meta( $order->get_id(), '_atum_location', true );

    if ( ! empty( $atum_location ) ) {
    ?>
    <tr class="atum-location">
    <th>ATUM Location:</th>
    <td><?php echo esc_html( $atum_location ); ?></td>
    </tr>
    Thread Starter sofiahz

    (@sofiahz)

    <tbody>
    <?php foreach ( $this->get_order_items() as $item_id => $item ) : ?>
    <tr class="<?php echo esc_html( $item['row_class'] ); ?>">
    <td class="product">
    <p class="item-name"><?php echo esc_html( $item['name'] ); ?></p>
    <?php do_action( 'wpo_wcpdf_before_item_meta', $this->get_type(), $item, $this->order ); ?>
    <div class="item-meta">
    <?php if ( ! empty( $item['sku'] ) ) : ?>
    <p class="sku"><span class="label"><?php $this->sku_title(); ?></span> <?php echo esc_attr( $item['sku'] ); ?></p>
    <?php endif; ?>
    <?php if ( ! empty( $item['weight'] ) ) : ?>
    <p class="weight"><span class="label"><?php $this->weight_title(); ?></span> <?php echo esc_attr( $item['weight'] ); ?><?php echo esc_attr( get_option( 'woocommerce_weight_unit' ) ); ?></p>
    <?php endif; ?>
    <?php if ( ! empty( $location['wp_list_filter'] ) ) : ?>
    <p class="item_location"><span class="inventory_labels"><?php $this->inventory_labels(); ?></span> <?php echo esc_html( $inventory_labels); ?><?php echo esc_html( get_option( 'get_location_labels' ) ); ?></
    <?php endif; ?>
    <!-- ul.wc-item-meta -->
    <?php if ( ! empty( $item['meta'] ) ) : ?>
    <?php echo wp_kses_post( $item['meta'] ); ?>
    <?php endif; ?>
    <!-- / ul.wc-item-meta -->
    </div>
    <?php do_action( 'wpo_wcpdf_after_item_meta', $this->get_type(), $item, $this->order ); ?>
    </td>
    <td class="quantity"><?php echo esc_html( $item['quantity'] ); ?></td>
    </tr>
    <?php endforeach; ?>
    </tbody>

    Here is the code from the body to see where I have put the code trying to get it in. I have managed to get the name there but not the location information.

    If we buy pro version does that mean we can just choose to add this information?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @sofiahz,

    If I understood correctly, the ATUM plugin stores the location in the item meta. If so, you should be able to display it in the PDF invoice with the following code snippet:

    /**
    * WooCommerce PDF Invoices & Packing Slips:
    * Display item location after item meta (if not empty)
    */
    add_action( 'wpo_wcpdf_after_item_meta', function( $document_type, $item, $order ) {
    if( isset( $item['item'] ) ) {
    // Change 'location' with the actual meta key in the next line
    if ( $value = $item['item']->get_meta( 'location' ) ) {
    echo "<div class=\"item-meta\"><small>Location: {$value}</small></div>";
    }
    }
    }, 10, 3 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use code snippets.

    We also have a blog post here that you may find helpful about adding custom code to your site.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.