Viewing 1 replies (of 1 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @lennycatena,

    This is possible adding this code snippet to your site:

    /**
     * Enable invoices based on payment method
     */
    add_filter( 'wpo_wcpdf_document_is_allowed', 'wpo_wcpdf_invoice_based_on_payment_method', 10, 2 );
    function wpo_wcpdf_invoice_based_on_payment_method( $allowed, $document ) {
      if ( $order = $document->order ) {
        if ($document->type == 'invoice') {
    		$payment_method = $order->get_payment_method();
    		$disalled_payment_method = [ 'stripe', 'apple-pay'];
          $allowed = ( in_array($payment_method, $disalled_payment_method) ) ? false : true;
        }
      }
      return $allowed;
    }

    You need to replace stripe and apple-pay for the actual payment method name. You can find them under WooCommerce > Settings > Payments, select the payment method and see the URL: the name after &section= is the one you need to put there.

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Let me know if it works! ??

Viewing 1 replies (of 1 total)
  • The topic ‘do not create invoice’ is closed to new replies.