Invoicing – sent emails

This topic contains 4 replies, has 2 voices, and was last updated by  Nigel Hancock 4 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #508581

    Nigel Hancock
    Expired Member
    Post count: 83

    I’m using the invoicing plugin – forgive me if this isn’t the right area to post but I’m not certain where it should live!

    We have paid and free listing options in several CPTs. Is there any way to stop invoice/payment emails going to the listing owner when package price is zero (free)? Seems a pretty basic requirement?

    #508599

    Alex Rollin
    Moderator
    Post count: 27815
    #508876

    Nigel Hancock
    Expired Member
    Post count: 83

    Thank you Alex but, forgive my ignorance – which file should the snippet be included?

    /**
     * Prevent sending invoice email notifications to user for free invoices.
     */
    function gd_snippet_prevent_invoice_email_for_free_listing( $recipient, $email_type, $invoice_id, $invoice ) {
    	if ( class_exists( 'GeoDir_Pricing_Post_Package' ) && ! empty( $invoice ) && $invoice->is_free() ) {
    		$post_packages = GeoDir_Pricing_Post_Package::get_items( array( 'invoice_id' => $invoice_id ) );
    
    		if ( ! empty( $post_packages ) ) {
    			$recipient = NULL; // No recipient.
    		}
    	}
    	return $recipient;
    }
    add_filter( 'wpinv_email_recipient', 'gd_snippet_prevent_invoice_email_for_free_listing', 100, 4 );
    #508920

    Alex Rollin
    Moderator
    Post count: 27815

    We recommend using the customizer for CSS and the Code Snippets plugin for PHP snippets. More on that here: https://wpgeodirectory.com/docs-v2/faq/customizing/

    #508957

    Nigel Hancock
    Expired Member
    Post count: 83

    Works perfectly thank you Alex

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket