Hi @mbv
Your question is a good one. Currently, the WooCommerce Stripe Payment Gateway does not have a built-in feature to exclude virtual products from the “Issue an authorization on checkout, and capture later” option.
However, with the flexibility of WooCommerce, it is possible to achieve what you are asking for with a bit of custom coding. This would involve adding a function that checks if an order contains only virtual products and, if so, automatically captures the payment instead of issuing an authorization.
Unfortunately, custom coding is not something we can assist with directly. However, you can create a custom function using the woocommerce_payment_complete action. When this action is triggered (i.e., a successful payment is made), you need to check if all the items in the order are virtual products. If they are, you need to mark the order as paid and complete it automatically.
To understand further about the functions and concepts, you can refer to the official documentation of WooCommerce:
- https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/
- https://woocommerce.com/document/automatically-complete-orders/
wc_get_order()
function
get_items()
method of the WC_Order class
get_product_from_item()
method of the WC_Order class
is_virtual()
method of the WC_Product class
payment_complete()
method of the WC_Order class
If you’re not comfortable with coding, I highly recommend hiring a professional developer or reaching out to one of the WooCommerce Experts who can help you with this.
If you have any further questions on development or custom coding, don’t hesitate to reach out to some of the great resources we have available for support. Our WooCommerce community is brimming with skilled open-source developers who are active on the following channels:
As for your suggestion to add this feature to the WooCommerce Stripe Payment Gateway plugin, I think it’s a great idea, and I’ll make sure to pass it on to our development team for consideration in future updates.
Thank you for your valuable input and for choosing WooCommerce. If you have any other questions or need further assistance, please don’t hesitate to ask.