I have a tiny webapp that I want to sell the "access" to it. The app is developed with HTML5+CSS3+JavaScript, is hosted in the same server that I have my Wordpress webpage installed.
How can I do to grant access to my webapp for the user who has already payed for my this virtual product (access/license).
I have maded a login in PHP, is there a way to check in the WooCommerce database and use the same user and password that the client use to pay for the product? Or is there another simple way?
I'm new at wordpress and woocommerce, so please forgive that and my horrible way to write english.
Thanks for reading.
Maybe insted look for this status better is use hooks and filters which Woocommerce offers? From my expirience it's short way to achieve what you want. Here is example of using it: LINK . Take hooks which is responsible for status: completed and than add action to it.
Woocommerce Memberships - allow you to combine product with permission: if user buy product which would be binded to product he recieves the access to api.
I hope that will help you.
EDIT:
$sales = $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} as posts
WHERE posts.post_type = 'shop_order'
AND posts.post_status IN ( '" . implode( "','", array( 'wc-completed', 'wc-processing', 'wc-on-hold' ) ) . "' )
" );
It's query to database which search for all ordres marked as completed and proccesing. MySQL query to select IDs of orders with status:completed
SELECT ID FROM wp_posts WHERE wp_posts.post_type="shop_order" AND wp_posts.post_status="wc-completed";
EDIT 2
And also another informations are stored in wp_comments. Inside wp_comments are four important columns: comment_post_ID, comment_content, comment_type and user_id
comment_post_ID = ID from wp_posts
comment_content have information about transaction, which should be recognized by your program.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.