I'm working on a plugin and rather than write my own payment processing code I was wondering if I could leverage woocommerce to do this. My plugin handles what amounts to rental spaces and all the custom management stuff is done with my plugin. It would be nice if there is a way for woocommerce to just to collect and log payments for my plugin. Is this possible? Most of the examples I've found about the API seem to apply to remote API use for woocommerce.
Thanks
I'm working on a plugin and rather than write my own payment processing code I was wondering if I could leverage woocommerce to do this. My plugin handles what amounts to rental spaces and all the custom management stuff is done with my plugin. It would be nice if there is a way for woocommerce to just to collect and log payments for my plugin. Is this possible? Most of the examples I've found about the API seem to apply to remote API use for woocommerce.
Thanks
Share Improve this question asked Nov 6, 2020 at 20:59 user6972user6972 636 bronze badges 1- 1 I'm going to try the same thing. So far my idea is to dynamically generate a woocommerce product with the required price and description, programmatically add that product to the cart and use a completely customized checkout page with my own fields to allow the payment. – Ivan Shatsky Commented Nov 11, 2020 at 10:48
1 Answer
Reset to default 1It is possible, but you're going to need a product to log in your orders. You could create a product 'placeholder' and then pass variables to the cart before checkout. This way the actual product already exists but everything else in WooCommerce will perform as normal.
Orders don't store a link to the current price of the item as prices change from time to time and then order history would be useless.
An example: The product could be "Rental Space" with a zero value that the user adds to the cart. Your plugin gives it a price in the cart and WooCommerce (and your chosen payment gateway) do the rest.
Your 'logs' would be the WooCommerce orders created per checkout.