• Hello to everyone. I have to say using your plugin is amazing. I am trying to customize the way it works. I will present my useage case:
    First of all, I want to always create packing slips on every order (this is working).
    Secondly I have a custom checkbox where a user selects if he wants an invoice. I want the plugin to create an invoice when this checkbox is selected. If this is not possible, I want to create an invoice manualy for these orders. Finaly, is there a way to cancel an invoice?
    (In Greece we need invoices for business clients).
    Any help would be really appreciated, thank you in advance.

Viewing 1 replies (of 1 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @progounick

    For the checkbox request, try this (change the meta name and value with yours):

    add_filter('wpo_wcpdf_document_is_enabled', 'wpo_wcpdf_enable_invoice_on_checkbox', 10, 2);
    function wpo_wcpdf_enable_invoice_on_checkbox($enabled, $document_type)
    {
    	if( $document_type == 'invoice' ) {
    		$enabled = false;
    		$order = wc_get_order(get_the_id());
    		$checkbox = $order->get_meta('checkbox_meta_name'); // Change the meta name to your's
    		if( !empty($checkbox) && $checkbox == 'some_value' ) { // Change to your checkbox value
    			$enabled = true;
    		}
    	}
    	return $enabled;
    }

    If you never worked with filters/actions please read this documentation: How to use filters

    About the cancel invoice, by default our plugin keeps the original order data to meet accounting standards, but we have the Professional extension that adds a new document called “Credit Note”. You could attach it to a refunded order status and it will generate a new document like a “negative invoice”.

    • This reply was modified 4 years, 6 months ago by alexmigf.
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Invoice or Manual’ is closed to new replies.