• Resolved MBV

    (@mbv)


    Is it possible to have the “Issue an authorization on checkout, and capture later” option exclude virtual product orders?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter MBV

    (@mbv)

    In other words, I would like orders with only virtual products to be completed and captured automatically. How can I do that, or otherwise can this be a added feature to this plugin?

    Plugin Support Shameem R. a11n

    (@shameemreza)

    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:

    1. https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/
    2. https://woocommerce.com/document/automatically-complete-orders/
    3. wc_get_order() function
    4. get_items() method of the WC_Order class
    5. get_product_from_item() method of the WC_Order class
    6. is_virtual() method of the WC_Product class
    7. 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue an authorization on checkout, and capture later – EXCEPT VIRTUAL PRODUCTS?’ is closed to new replies.