I am trying to extend this awesome plugin to work as an access to content (membership-like).
I know there are plenty of membership plugins out there, but they're not exactly what I am looking for.
What the project is about: A website that sells time limited access to specific posts (in this case it will be product posts). This includes access to whole categories (to products belonging to the respective category) and fullsite content.
I thought of keeping everything simple and doing the following:
1. Create a table with
orderkey (or orderid?)
2. Hook at the moment when an order's status is turned from pending to completed a function that does the following:
a. get all of the products from the order that is about to be completed
b. calculate the added time for expiration_time (the value is fixed by the admin, for all the products)
c. for each product insert a row in the table
3. Then instead of seeing the picture of the product when you visit it, i do an if statement to check if the user has access or not and display content accordingly
4. Make woocommerce auto-turn orders from pending to complete, when paypal confirms payment
Tell me what you think.
For point 2.
I think the hook i'm looking for is woocommerce_payment_complete_order_status which will be used for point 4. as well.
For point 3.
From the templates folder, i see i need to bring modifications to single-product.php
For point 4.
Based on this example i see it is rather simple to complete.