• Resolved nitinsaraswat4u

    (@nitinsaraswat4u)


    Hello,

    I want to create 2 sets of invoices (that too for specific payment methods – wc-upi) – one for billing country India (prefix CP, suffix IND) and second for all other countries (prefix CP, suffix ROW). Both these set of invoices should have their separate invoice number sequence too. For example, India can have CP0001IND and others can have CP0001ROW. Is this possible using some sort of code snippet. Currently I am able to generate invoices only for payment method wc-upi and country India, using the following.

    add_filter('wpo_wcpdf_document_is_allowed', 'disable_pdf_for_specific_payment_methods', 10, 2);

    function disable_pdf_for_specific_payment_methods($allowed, $document) {
    // Get the order object
    $order = $document->order;

    // List of payment methods for which PDF invoices should be generated
    $allowed_payment_methods = array('wc-upi'); // Replace 'cod', 'bacs' with the desired payment methods

    // Get the payment method and billing country for the current order
    $payment_method = $order->get_payment_method();
    $billing_country = $order->get_billing_country();
    // error_log('Order No. ' . $order->get_order_number() . ' Payment method is ' . $payment_method . ' Billing country is ' . $billing_country);
    // Check if the payment method is in the allowed list
    if (!in_array($payment_method, $allowed_payment_methods) || $billing_country !== 'IN') {
    // Disable PDF invoice generation
    return false;
    }

    // Enable PDF invoice generation for the allowed payment methods
    return $allowed;
    }

    }

    Thanks in advance for your help.

    Regards,

    Nitin

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Multiple invoice series’ is closed to new replies.