• Resolved atojurian

    (@atojurian)


    Hi there! I have a small question which I couldn’t find the answer to: Is it possible somehow to generate a different invoice depending on the product?

    Alternatively, is it possible to add a conditional check in the invoice.php file to display something else depending on the product ID or SKU?

    Thanks in advance for any help!

    Jurian

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

    (@yordansoares)

    Hello @atojurian,

    Is it possible somehow to generate a different invoice depending on the product?

    It’s possible to add conditional information in some areas of the document (such as in the customer notes section), but if you want to use a different invoice layout based on the product type, this will require a custom work.

    Alternatively, is it possible to add a conditional check in the invoice.php file to display something else depending on the product ID or SKU?

    Again, it depends on what you want to show and where. Can you describe in detail what you want to achieve?

    When you send us the details of what you want to achieve, I’ll try to guide you on the easiest way to do it ??

    Thread Starter atojurian

    (@atojurian)

    Hi Yordan,

    Thanks for getting back to me so quickly. The only thing I need really is to display a different logo when a certain product is purchased. Would that be achievable? ??

    Kind regards,

    Jurian

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @atojurian,

    Sorry for the late reply!

    What if there is more than one product, how do you determine which logo will be used?

    However, you can use the following template filter hook: wpo_wcpdf_header_logo_id

    E.g.:

    add_filter( 'wpo_wcpdf_header_logo_id', function( $logo_id, $document ) {
      if ( !empty($document->order) ) {
    
        // $condition = $your_query;
        // if ( $condition == true) {
        //   $logo = 123; // post ID of the logo file in WordPress			
        // }
        
      }
      return $logo_id;
    }, 10, 2);

    Hope it helps! ??

    Thread Starter atojurian

    (@atojurian)

    Hey Yordan,

    Luckily purchasing more than one product is not a use case for this ??

    Thank you for the suggestion, I’ll look into it, test it out and let you know how it goes!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @atojurian,

    Since we haven’t heard back from you in the last two weeks, we’re assuming you found a fix, so I’ll go ahead and mark this ticket as Resolved.

    Feel free to open a new topic if you have any more questions!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different invoice for different product?’ is closed to new replies.