• Resolved macsi

    (@macsi)


    Hi

    I need to generate and send an invoice ONLY for orders which are worth more than 100 €

    Is there any way to manage that directly thru the plugin?

    Thanks a lot

    Gil

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hi @macsi,

    Does your shop only sell in Euros? If yes, then coming up with the code snippet is quite simple:

    add_filter('wpo_wcpdf_custom_attachment_condition', function( $condition, $order, $status, $template_type ) {
    	if ( $template_type == 'invoice' ) {
    		
    		$total = $order->get_total();
    	
    		if ($total < 100) {
    			$condition = false;
    		}
    	}
    	return $condition;
    }, 10, 4 );

    If you will deal with multiple currencies, the code snippet you’ll need will be more complex.

    • This reply was modified 5 years, 2 months ago by Darren Peyou. Reason: forgot to add snippet
    • This reply was modified 5 years, 2 months ago by Darren Peyou. Reason: fix mistake
    Thread Starter macsi

    (@macsi)

    Hi

    Yes I only use Euros currency.
    Thanks a lot for your efficiency 😊

    Plugin Contributor Darren Peyou

    (@dpeyou)

    Hi @macsi,

    I made a little correction, removing a line that didn’t need to be there.

    This line was just for testing -> var_dump($total)

    Please recopy the code in my previous answer as it has been updated. 🙂

    Thread Starter macsi

    (@macsi)

    Great
    I tell you as soon as I have tested.
    Thanks again

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Desactivate invoice for low amount orders’ is closed to new replies.