Support » Plugin: WooCommerce PayPal Pro Payment Gateway » Add invoice prefix

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, thank you for reaching out to us. I have submitted a message to the developers to investigate further your request.

    Kind regards.

    Thread Starter Marketing1on1

    (@marketing1on1com)

    Any update? All we need is just a field in the admin menu where we can add a “prefix” that way there are no “duplicate invoices” if we are using the same PayPal account on multiple sites.

    Thread Starter Marketing1on1

    (@marketing1on1com)

    Any news? Can you tell us how we can add a custom invoice prefix for CC payments that way if we are using the same PayPal account we won’t run into “duplicate invoice” issues?
    Woocommerce PayPal payments currently offers it, but their plugin is buggy.

    Thread Starter Marketing1on1

    (@marketing1on1com)

    We figured it out on our own. For anyone who is interested, just have to modify the file woo-paypal-pro-gateway-class.php

    Open the plugin folder
    Edit the file woo-paypal-pro-gateway-class.php
    Scroll down to line 381:
    ‘INVNUM’ => $this->order->get_order_number(),

    Change it to:

    ‘INVNUM’ => “Your-Prefix-Here” . $this->order->get_order_number(),

    Plugin Author wp.insider

    (@wpinsider-1)

    It’s better to use a filter hook for this. Our addon gets the order number from WooCommerce. So you can use the following woocommerce filter to customize it:

    
    woocommerce_order_number
    

    Here is the code reference for it:
    https://woocommerce.github.io/code-reference/files/woocommerce-includes-class-wc-order.html#source-view.480

    I will also add a filter hook for invoice number in our addon.

    Thread Starter Marketing1on1

    (@marketing1on1com)

    Can you please elaborate on using the filter hook? We don’t want to change the order number on Woocommerce, just add an invoice prefix to the PayPal.

    Plugin Author wp.insider

    (@wpinsider-1)

    The following shows the new filter that we added to the repository. You can download a copy of the addon from github and use it (if you don’t want to wait for the next release):
    https://github.com/wp-insider/woocommerce-paypal-pro/blob/ee00834bf17524c736c7db1b8d3c9094b955ecbe/woocommerce-paypal-pro/woo-paypal-pro-gateway-class.php#L381

    Below is an example of how to use this filter to add a prefix:

    
    add_filter( 'wcpprog_invnum_woo_order_number', 'my_custom_order_number' );
    function wcpprog_invnum_woo_order_number ($inv_num) {
        $inv_num = "Your-Prefix-Here" . $inv_num;
        return $inv_num;
    }
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add invoice prefix’ is closed to new replies.