M

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts

  • M
    Buyer
    Post count: 5

    Great stuff, thanks Patrik.
    Seems like it’s working. We will let the customers know that tried before … to try again.
    Thanks
    Marc


    M
    Buyer
    Post count: 5
    This reply has been marked as private.

    M
    Buyer
    Post count: 5

    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


    M
    Buyer
    Post count: 5

    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?


    M
    Buyer
    Post count: 5
    This reply has been marked as private.
Viewing 5 posts - 1 through 5 (of 5 total)