• Resolved boo6ie

    (@boo6ie)


    Hi,

    I want to include in the PDF, the amount of the product excluding VAT as well as the amount of VAT for this product

    For instance :

    //Price of the product exclude VAT

    <td class="product-price-exclude-vat" data-title="<?php esc_attr_e( 'Prix HT', 'wc-cart-pdf' ); ?>">
    <?php
    echo esc_html( $_product->get_price_excluding_tax() );
    ?>
    </td>

    //Amount of the product’s VAT

    <td class="product-vat" data-title="<?php esc_attr_e( 'Prix HT', 'wc-cart-pdf' ); ?>">
    <?php
    echo esc_html( $_product->get_tax() );
    ?>
    </td>

    Do you have an example for this improvement?
    Thank you ??

    • This topic was modified 2 years ago by boo6ie.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter boo6ie

    (@boo6ie)

    For the price of product exclude VAT, i use :

    echo apply_filters( 'woocommerce_cart_item_price', wc_get_price_excluding_tax( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );

    But how to multiply by the “quantity” of product to get the total price for the product?

    Thread Starter boo6ie

    (@boo6ie)

    And for the tax, i do that:

    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $with_tax = $_product->get_price_including_tax();
    $without_tax = $_product->get_price_excluding_tax();
    $tax_amount = $with_tax - $without_tax;
    
    [...]
    
    <td class="product-price" data-title="<?php esc_attr_e( 'TVA', 'wc-cart-pdf' ); ?>">
    <?php
    echo woocommerce_price($tax_amount );
    ?>
    </td>
    Thread Starter boo6ie

    (@boo6ie)

    Finally it’s good ??
    I just multiplied by the quantity.

    
    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $quantity_product = $cart_item['quantity'];
    $with_tax = $_product->get_price_including_tax();
    $without_tax = $_product->get_price_excluding_tax();
    							 
    $tax_amount = ($with_tax - $without_tax) * $quantity_product;			 
    $total_ht = $quantity_product * $without_tax;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Include the product’s price excluding VAT and the amount of VAT’ is closed to new replies.