Deleting Woocommerce webhooks via cronjob - wordpress

I am using Wooocommerce and an invoice/product inventory system which is implemented via Woocommerce API. I need live synchronization but the problem with this is that the inventory system is adding thousands of webhooks while synchronizing, which is making the site extremely slow. Does anyone know if it is possible to set up a cronjob to delete all webhooks in certain intervals?

Yes it is possible to setup a cronjob to delete all web-hooks. You can also delete a single or batch delete the web-hook. Here is the documentation link for batch and single web-hook delete link.

Related

Delete WooCommerce Analytics data

I try to anonymize WooCommerce for debug access by third party plugin developers with a bash command line script on my linux server. I successfully could remove users and orders but now I discover that all the sales statistics are still available in WooCommerce' Analytics including names and figures. Where do I find this in database so I can include it my database query to address it?
By request I include here a screenshot of WC analytics' first page with sales and order reports, financial data not to be revealed a plugin author.
Try to run WooCommerce > Status > Tools > Clear Analytics Cache tool. Analytics dashboard is using a lot of caching, otherwise it would be too slow. Before clearing the cache, make sure you empty the orders from the trash too.
And while you are on the WooCommerce > Status > Tools page, delete all transients too.

Deleting order Woocommerce orders via API

I want to programmatically delete old orders in Woocommerce, to try to assist database performance, so I am considering running this via the API documented below. The documentation doesn't detail exactly what is deleted - is it just the order, and its metadata? Does it delete the notes of an order for example?
https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-an-order

how can run automatic Regenerate Product lookup tables on WooCommerce -> Status -> Tools by cron jobs?

I have imported the products using some API's. But Every time I import the products, it's ask to regenerate the woocommerce lookup tables. So how can I run Regenerate Product lookup tables on WooCommerce -> Status -> Tools by cron jobs programmatically?
This issue is over a year old so I'm guessing you've either figured it out or moved on. I'm posting this here more as a shortcut for anyone looking into this in the future.
You have a few ways you can accomplish regenerating product lookup tables for WooCommerce.
1. Use the WooCommerce REST API
The WooCommerce REST API documentation is pretty helpful here. Do a GET request to get a list of all the available tools from system status, then run a PUT request as noted in the docs here - https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-tool-from-system-status
You'll want to generate API keys in WooCommerce before making those requests. They've got it pretty well documented here as well - https://docs.woocommerce.com/document/woocommerce-rest-api/
2. Use the WP-CLI
If you're a die-hard WordPress developer you could benefit from using the WP-CLI tool - https://make.wordpress.org/cli/handbook/
You'd run the command wp wc tool run regenerate_product_lookup_tables --user=1
3. Bake it into the WordPress admin panel
As noted in the WooCommerce developer documentation you can use the update_lookup_table method from the WC_Data_Store_WP class - https://developer.woocommerce.com/2019/04/01/performance-improvements-in-3-6/
This feels overkill since you can just go to WooCommerce > Status > Tools > Product lookup tables and click the "Regenerate" button on the right. I guess it could be useful if you're using an automation tool like Selenium to log into your WordPress and do things. I could see the benefit of using update_lookup_table in a custom admin page or plugin to reduce the amount of clicks and page loads that your script would need to navigate.

Automatically send a newsletter everytime a page is updated

I have this page:
http://www.thedome.it/cmsms/index.php?page=alla-spina
I'd like to send a newsletter to subscribers every time this page is updated, automatically. I don't have admin privileges for this CMS thus I can't install modules, so I was thinking about a service such as FeedBurner, if only this page had a unique RSS feed (but AFAIK it doesn't, right?).
Do you know of any service/software that will allow me to solve this particular problem?
Thanks.
To do this without access to the server you will need another server with corn jobs enabled.
If I there you I would create a simple scrape script which would also check if the content of the page have not changed. Using print version of the page may make it much easier to process. The last thing to do is to set up a corn job which would run the script at desired intervals.

Combine and secure a dual Wordpress installation

I've been assigned to add some features to an existing newspaper. This newspaper is based on Wordpress. They want to add a subscription feature for subscribed users to receive email with the latest news and some other stuff.
They also want a coupon system, which I'm planning to implement using CouponPress (http://www.couponpress.com/) which is a separate Wordpress installation for coupons.
They want to keep the subscribers functionality completely separated from the main blog to avoid opening security holes for attackers to gain admin or editor roles and mess with the newspaper.
What do you recommend for this?
If I keep the subscription feature attached to the second blog, is there a plugin or something to automatically email the subscriptors of the second blog with latest entries, a daily or weekly? I want the second blog to look as part of the first one for users. Maybe replicating the user list somehow in the main blog, but avoiding sign in on it.
What do you think?
Thanks for your help
just throwing an idea for the subscription feature, if you do go the path of subscription to the other blog you can write some quick and dirty function to query the new or even an sql trigger to copy new user recordds to the other db (I don't know if mysql allows for inter db copy triggers)
but - I don't really know what'll you'll achieve that way. if the data isn't secure and sanitized someone could try to run an sql injection. and then copying the record to the other db would contaminate it either.
better use on of wordpress good security plugins, harden server access etc

Resources