Getting Subscription Products from WooCommerce - wordpress

I am trying to access my site's Subscription Products via REST API. At wc/v1/subscriptions I can get the active subscriptions, and at wc/v3/products I can get all products except subscriptions.
There isn't anything in the WC Subscriptions documentation about subscription products. This site implies that I can provide an API for this, but I am not a PHP programmer. I do have access to the server and can put code in functions.php or wherever it would belong.
Can anyone provide me with the code to achieve this? I ask here because I hope it's relatively simple, like the get_posts_meta code I've found on a number of blogs/sources to expose some other API data.
Thanks a lot.

Related

Send API after payment completed WooCommerce

I have an e-commerce on Wordpress where I put my products for sale through WooCommerce and a demand arose for an advantage club where, after payment was made, it would send data to an API to create an account on a platform and when is no longer paid to be deactivated by the same API. How can I do this? Is there any way?
I looked for documentation on the internet but I couldn't find much.
You can use, a hook that runs when an ordered is marked as completed:
woocommerce_order_status_completed
if that doesnt work for you, you need to check the payment gateway provider, to see what hooks they offer

WooCommerce REST API – Prevent product deletions

I am trying to prevent products and variations from being deleted through the WooCommerce REST API. Deletion should still be able from the admin interface, though.
Is there any way to achieve this?
Can I somehow overwrite the behaviour of the WooCommerce REST API when a DELETE request is sent?
Thanks!

How to hide Published Custom Post if a users membership has expired

WordPress Experts
can anyone help me with this topic?
I am creating a directory for a client. They have a membership site using woocommerce subscriptions. I created a custom post type for their members to manage their listings. I am trying to hide listings for anyone who lets their membership expire. I can't find a way to do it. It seems to me that this should be possible but I haven't found a solution and I am hoping I might have missed it or that someone else may have come across this already.
Any help is greatly appreciated.
You can use the wc_memberships_user_membership_status_changed hook to catch every membership's status update. Whenever a membership becomes cancelled or expired, you need to:
Get user ID
Get all user's posts belonging to your custom post type
Loop through each post and update its status to private using the wp_update_post() function (or run a single SQL query doing the same thing)

Linkedin API Webhooks

We are developing a platform to help freelancers schedule #linkedin posts for their clients and manage comments on those posts.
I understand from the documentation that LinkedIn provides webhooks for apps to get notified when a Page post receives comments but I can't find a way to enable that feature. At the moment we are basically query the API frequently enough to make it look like it is a webhook but that is not a proper solution.
Is it a very restricted feature just like video UGC posts (which would be nice to have as well)?
Or can we apply somehow?
Any help is appreciated, thanks.

Add user on UrBackup server after order on Woocommerce site

I have wordpress site with woocommerce shop and I’m selling among others UrBackup client accounts on my server.
Do you have any idea how to automatically add UrBackup user after order in woocommerce?
Or maybe easier will be create shop based on different engine?
Any advice, tips? :)
After poking around a bit, it looks like UrBackup has an API you can use, that most likely has a 'create account' endpoint. I didn't see it immediately in their not-so-great documentation, but you'd think it'd HAVE to be there somewhere! There's also a PHP API kit you could integrate into your WordPress site here:
https://bitbucket.org/opensaucesystemsdevelopment/urbackup-api.git
So, you could load in this class, and after a WooCommerce order is placed, call the API endpoint to create a user. To do this with WooCommerce, you'd need to create a function on the "woocommerce_order_status_completed" hook.
http://hookr.io/actions/woocommerce_order_status_completed/
This would let you run any custom code you'd like after an order's payment has completed. Thus, you could check an order for if it contains the UrBackup product, and if so call the UrBackup API to create an account based on the current user's data.
Should work!

Resources