• Resolved rockso

    (@rockso)


    Hi, I use perfect Perfect Brands for WooCommerce and I would like to add the brand’s name to this plugin’s packing slip and invoice.

    Does anyone know how?

    Thank you,

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

    (@yordansoares)

    Hi @rockso,

    Try adding this code snippet to your site:

    /** 
     * Display product brand on invoice (Perfect Brands for WooCommerce)
     */
    add_action( 'wpo_wcpdf_after_item_meta', "wpo_wcpdf_after_item_meta_product_description", 10, 3);
    function wpo_wcpdf_after_item_meta_product_description( $document_type, $item, $order ) {
      if($document_type == 'invoice' && taxonomy_exists('pwb-brand')) {
        $product_id = $item['product_id'];
        $product_brands = wp_get_post_terms($product_id, 'pwb-brand');
        if (!empty($product_brands)) {
          echo '<dl class="brand">';
          echo '<dt>Brand: ';
          echo '<dd>';
          foreach ($product_brands as $brand) {
            $brand_link = get_term_link($brand->term_id, 'pwb-brand');
            echo '<a href="' . $brand_link . '">' . $brand->name . '</a> ';
          }
          echo '</dd>';
          echo '</dt>';
          echo '</dl>';
        }
      }
    }

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

    Let me know if worked!

    Thread Starter rockso

    (@rockso)

    you are amazing! That worked perfectly! thank you!!!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to know that it worked!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding brand to packing slip & invoice’ is closed to new replies.