Documentation

WooCommerceScanner
in package
uses UtilsProvider

Skip automatic scanner rescans for WooCommerce stock-only product saves (e.g. POS sync).

Listens to woocommerce_before_product_object_save, which WooCommerce builds at runtime as woocommerce_before_{object_type}_object_save (WC_Product::$object_type is product).

Tags
see
https://github.com/woocommerce/woocommerce/blob/2c17a3cdf85fa1fd2a5bfc59dc6aff24e3f8ad56/plugins/woocommerce/includes/abstracts/abstract-wc-product.php#L1559
https://wordpress.org/plugins/woocommerce/
https://wordpress.org/plugins/woo-izettle-integration/
https://de.wordpress.org/plugins/zettle-pos-integration/

Table of Contents

Constants

STOCK_ONLY_META_KEYS  : mixed = ['_stock', '_stock_status', '_manage_stock', '_...
Post meta keys written by WooCommerce stock sync without content edits.
STOCK_ONLY_PRODUCT_CHANGE_KEYS  : mixed = ['stock_quantity', 'stock_status', 'manage_stoc...
WooCommerce product props that do not change cookie-relevant page output.

Properties

$me  : WooCommerceScanner
Singleton instance.
$pendingProductChanges  : array<int, array<string, mixed>>
Pending WooCommerce product changes keyed by product ID.

Methods

getInstance()  : mixed
Get singleton instance.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
init()  : mixed
Register hooks in `init` action.
skip_stock_only_product_save()  : mixed
Skip automatic rescans when a product save only changed stock-related data.
woocommerce_before_product_object_save()  : mixed
Record WooCommerce product changes before `save_post` so stock-only updates can be ignored.
isStockOnlyMetaDataChange()  : mixed
Check if changed product meta is limited to stock-related keys.
isStockOnlyProductSave()  : mixed
Check if a WooCommerce product save only changed stock-related data.

Constants

STOCK_ONLY_PRODUCT_CHANGE_KEYS

WooCommerce product props that do not change cookie-relevant page output.

public mixed STOCK_ONLY_PRODUCT_CHANGE_KEYS = ['stock_quantity', 'stock_status', 'manage_stock', 'backorders', 'low_stock_amount']

Properties

$pendingProductChanges

Pending WooCommerce product changes keyed by product ID.

private array<int, array<string, mixed>> $pendingProductChanges = []

Methods

getInstance()

Get singleton instance.

public static getInstance() : mixed
Tags
codeCoverageIgnore

getPluginConstantPrefix()

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

skip_stock_only_product_save()

Skip automatic rescans when a product save only changed stock-related data.

public skip_stock_only_product_save(bool $skip, WP_Post $post) : mixed
Parameters
$skip : bool
$post : WP_Post

woocommerce_before_product_object_save()

Record WooCommerce product changes before `save_post` so stock-only updates can be ignored.

public woocommerce_before_product_object_save(object $product) : mixed
Parameters
$product : object

isStockOnlyMetaDataChange()

Check if changed product meta is limited to stock-related keys.

protected isStockOnlyMetaDataChange(mixed $metaChanges) : mixed
Parameters
$metaChanges : mixed

isStockOnlyProductSave()

Check if a WooCommerce product save only changed stock-related data.

protected isStockOnlyProductSave(int $post_id) : mixed
Parameters
$post_id : int
On this page

Search results