• Resolved groodo

    (@groodo)


    Just as there is an option to deactivate invoices for free products, how could it be done to deactivate invoices for purchases in a given country?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @groodo,

    That is certainly possible. You can use the following code snippet:

    // exclude certain countries from automatic pdf creation
    add_filter( 'wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_exclude_country', 100, 4 );
    function wpo_wcpdf_exclude_country( $condition, $order, $status, $document ) {
        $country = $order->get_billing_country();
        if ( $document == 'invoice' && $country == 'NL' ) {
            return false;
        } else {
            return $condition;
        }
    }

    You will have to add this snippet to the functions.php of your child-theme. If you have never worked with snippets or functions.php before please read this first: How to use filters

    The country excluded in this example is the Netherlands (country code NL). You can change this for any country code you like.

    Thread Starter groodo

    (@groodo)

    Thank you so much for the quick response.

    Thank you for your support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Deactivate invoices for purchases in a given country’ is closed to new replies.