wpsmswoopro_verification_product_restrictions
Limit checkout mobile verification to specific products or categories in WooCommerce.
The wpsmswoopro_verification_product_restrictions filter allows you to enable mobile OTP verification only for specific products or product categories during WooCommerce checkout.
Requirements
- WSMS WooCommerce Pro Add-on
Syntax
add_filter('wpsmswoopro_verification_product_restrictions', 'your_callback');
Return Value
Return an array with the following keys:
| Key | Type | Description |
|---|---|---|
product_ids | array | Product IDs that require mobile verification |
product_cats | array | Category IDs whose products require verification |
Finding IDs
Finding a Product ID
- Go to Products → All Products in WordPress admin
- Hover over your desired product
- Note the ID in the URL (e.g.,
post=187means Product ID is187)
Finding a Category ID
- Go to Products → Categories
- Hover over your desired category
- Note the ID in the URL (e.g.,
tag_ID=86means Category ID is86)
Example
Require mobile verification only for specific products and categories:
add_filter('wpsmswoopro_verification_product_restrictions', function () {
return [
'product_ids' => [187, 190],
'product_cats' => [86, 88],
];
});
Products Only
add_filter('wpsmswoopro_verification_product_restrictions', function () {
return [
'product_ids' => [187, 190, 195],
'product_cats' => [],
];
});
Categories Only
add_filter('wpsmswoopro_verification_product_restrictions', function () {
return [
'product_ids' => [],
'product_cats' => [86, 88],
];
});
Use Cases
- Require verification for high-value products only
- Enable OTP for digital products to prevent fraud
- Restrict verification to specific product categories
Related
Last updated: December 23, 2024