Product discount

Hi there,
I have two issues:

product discount
I have learnt that the discount on the total amount can either be an absolute value or a percentage. On the product (line item) level I can only enter an absolute value. Is it also possible to have a discount on the product level as percentage?

visibility
Ist it possible to completely hide the discount column when there is no discount for any item?

Hi,

If you change the invoice level discount to a percentage it will make the line item discounts also be a percentage.

There is an option to hide empty columns on Settings > Invoice Design.

Thanks so far!

If you change the invoice level discount to a percentage it will make the line item discounts also be a percentage

understood

There is an option to hide empty columns on Settings > Invoice Design

I already checked this option. But I run my own design as below and I fail at that point where I cannot use an $variable inside a ninja section (in the table header):

               <ninja>
               {% set isdiscount = false %}
               {% for item in entity.line_items|filter(item => item.type_id == 1) %}         
                  {% if item.discount > 0 %}      
                     {% set isdiscount = true %}
                  {% endif %}
               {% endfor %}
              
                  <table width="100%" cellspacing="0px" cellpadding="0px" class="tp-table01">
                     <thead>
                        <tr>
                           <th> $product.product1_label </th>
                           <th> $item_label/$product.description_label </th>
                           <th> $product.product2_label </th>
                           <th> $product.unit_cost_label </th>
                           {% if isdiscount %}
                           	  <th> $product.discount_label </th>
                           {% endif %}
                           <th> $quantity_label </th>
                           <th> $product.line_total_label</th>
                        </tr>
                     </thead>
                     <tbody>

               
               {% if invoices %}
                 {% set entity = invoices | first %}
               {% elseif recurringinvoices %}
                 {% set entity = recurringinvoices | first %}
               {% elseif quotes %}
                 {% set entity = quotes | first %}
               {% elseif credits %}
                  {% set entity = credits | first %}
               {% endif %}
               {% for item in entity.line_items|filter(item => item.type_id == 1) %}         
                        <tr>
                           <td>{{ item.custom_value1 }}</td>
                           <td>
                              <p class="tp-item">{{ item.product_key }}</p>
                              <p>{{ item.notes|nl2br }} </p>
                           </td>
                           <td>{{ item.custom_value2 }} </td>
                           <td>{{ item.cost }} </td>
                           {% if isdiscount %}
                              <td>{{ item.discount }} </td>
                           {% endif %}
                           <td>{{ item.quantity }} </td>
                           <td>{{ item.line_total }} </td>
                        </tr>
               {% endfor %}
                     
               </ninja>             
                     </tbody>
                  </table>

I suggest asking in a discussion on GitHub

This is strange:
$variables inside <ninja> do not work. That is what I experienced and what I also read somewhere in the forum.
BUT: The use of $variables inside twig code is explicitly proposed in the official docu:

Standard $ notation variables are also available within templates, this allows you to use familiar variables such as $invoice.amount - you can also combine twig and ninja variables like this to integrate conditionals into your template. ie

{% if invoice.balance > 0 %}
 $invoice.balance is payable!
{% else %}
 Invoice has been paid! Thanks!
{% endif %}

I suggest either asking on GitHub or since you’re on the hosted platform feel free to send an email to [email protected].

I am sorry to say that but the support there is very “poor” - to put it in nice words. I paid for a design that never worked. The technical competence is way off from that I get here in the forum from members like e.g. you and smitti

In that case you may want to try creating a discussion on GitHub. I’m one of the frontend developers, I’m less familiar with the template code.