Ninja Form Create Invoice Add On – invoice created without GB VAT

This topic contains 7 replies, has 3 voices, and was last updated by  patrik 15 hours, 22 minutes ago.

  • Author
    Posts
  • #3232

    HotHead
    Full Member
    Post count: 3

    Hi guys
    I’ve created a ninja form so that it creates an invoice using the Ninja Form addon.
    It creates the invoice fine, however the invoice does not include GB VAT even though I’ve setup (or think that I’ve setup correctly) to always charge 20% VAT.

    (Note: I’m using GeoDirectory, and VAT always gets applied to a listing package item invoice.)

    Have I missed something, I am passing the invoice item id through as a hidden field and mapping it to the item field in the “Create Invoice” Action. Do I need to pass more than this?

    #3233

    Alex Rollin
    Moderator
    Post count: 18205

    Please share site access so we can debug the issue. It should pass VAT

    “WordPress Credentials
    WP Admin Login URL:
    WP Admin Username:
    WP Admin Password:”

    #3234

    HotHead
    Full Member
    Post count: 3
    This reply has been marked as private.
    #3235

    patrik
    Moderator
    Post count: 1180

    Hi,

    Currently, after submitting a form only invoice is created with the items as admin will want to review or change the items before sending an invoice so you can click on recalculate total button and it will apply the tax in the invoice and then you can send the invoice to your customer.

    We will consider this and implement it in the next update. Thanks for noticing.

    Regards,
    Patrik

    #3242

    HotHead
    Full Member
    Post count: 3

    Hi Patrik

    Thanks for the information.
    I’ve tried to create a shortcode to do what I’m after using your function wpinv_insert_invoice().
    Bizarrely it seems to get stuck in a loop and create 1000s of invoices before the webbrowser comes back with an error.

    Here’s my code, I’ve literally just grabbed it from your examples and modified it to be a shortcode. Probably done something basic wrong.

    function create_blogging_invoice( $atts ) {
    
        $atts = shortcode_atts( array(
            'item_id' => null,
            'user_id' => null
        ), $atts );
      
      	$item_id = $atts['item_id'];
    	$user_id = $atts['user_id'];
     
    		  	$data = array(
    				'status'        => 'wpi-pending',
    				'user_id'       => $user_id,
    				'cart_details'  => array(
    					array(
    						'id'    => $item_id
    					),
    				)
    			);
    
    	  		$invoice = wpinv_insert_invoice( $data, false );	
      
      	return $invoice;
      	
    
    }
    add_shortcode( 'create_blogging_invoice', 'create_blogging_invoice' );

    Then I’m calling the above shortcode on a certain page load.

    Any idea why the above would create 1000s of invoices?

    #3243

    patrik
    Moderator
    Post count: 1180

    Hi,

    We don’t provide support for the customizations. Your code is not correct at all. You should use the hooks provided in our ninja form add on “wpinv_nf_after_create_invoice” and recalculate the total and save the invoice using the functions

    $invoice->recalculate_totals()

    and

    $invoice->save()

    . You can take the help of a developer who can do this easily.

    Regards,
    Patrik

    #3244

    HotHead
    Full Member
    Post count: 3

    Hi Patrik

    No worries, I don’t think I explained properly. I’ve basically scrapped the idea of using the Create Invoice Add On. This is a different problem relating to the function wpinv_insert_invoice()

    I’ll sort it myself, just was hoping you’d know what could cause the loop that I’ve got to save myself debugging it.

    Ta

    #3249

    patrik
    Moderator
    Post count: 1180

    Hi,

    I am not sure why you want to create a shortcode to create an invoice. You can check our shortcode [wpinv_buy] here https://wpinvoicing.com/docs/core-shortcodes/ which allows users to buy the item and generate the invoice.

    Regards,
    Patrik

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.