View Categories

Stock Manager Developer Hooks and Filters

This developer reference for Products Stock Manager with Excel for WooCommerce lists its filter, actions, cron event, schedules and stored options. The admin screen is at WPFactory > Stock Manager. Everything here was verified against Stock Manager Pro 4.0.3.

Filters #

Filter Default Description
wpfactory_wc_sm_pro_curl_disable_ssl false Return true to turn off SSL host and peer verification when the scheduled import downloads the Remote Excel URL with cURL. Use it only for a trusted source with a broken or self-signed certificate. Added in 4.0.1.
// Allow the scheduled import to download from a server with a self-signed certificate.
add_filter( 'wpfactory_wc_sm_pro_curl_disable_ssl', '__return_true' );

Actions and cron #

Hook Type Description
updateWithCron WP-Cron event Runs the scheduled import from the Remote Excel URL. Scheduled when settings are saved with Auto Import with Cron set to Yes and a frequency selected. Cleared when Auto Import is set to No or the plugin is deactivated.
wpfactory_wc_sm_pro_output_settings Action Fires when the Stock Manager admin page renders. The plugin uses it to output its tabs.

With WP-CLI you can trigger an import immediately:

wp cron event run updateWithCron

Cron schedules #

Stock Manager registers these intervals through the cron_schedules filter when they do not already exist:

Key Interval
1min 60 seconds
5min 300 seconds
10min 600 seconds
30min 1,800 seconds
1hour 3,600 seconds
6hours 21,600 seconds
12hours 43,200 seconds
daily 86,400 seconds
weekly 604,800 seconds
monthly 2,592,000 seconds (30 days)

AJAX actions #

Action Purpose
update_products Processes an uploaded .xlsx file. Requires the update_products nonce and the Administrator role.
smwpro_exportProducts Returns export table rows in batches. Requires the columnsToShow nonce and the Administrator role.

Product data written #

Updates write post meta directly with update_post_meta(), then refresh the post’s modified date (and the parent’s for variations) and call wc_delete_product_transients():

  • _stock, and _stock_status (set to instock when stock is above 0, or taken from the status column)
  • _regular_price, _sale_price and _price

Because meta is written directly, WooCommerce stock change actions such as low stock notifications are not triggered by these updates, and _manage_stock is never changed.

Options #

All settings are stored as options with the prefix stockManagerWooCommercePro, for example stockManagerWooCommerceProupdateStockNumber and stockManagerWooCommerceProimportUrl. The full list is in the Stock Manager settings reference.

Need a hand? Our team answers every ticket on the Stock Manager support forum.