Limiting Checkout Mobile Verification to Specific Products or Categories in WooCommerce

Updated on Jul 01, 2025

The Checkout Mobile Verification feature in the WP SMS WooCommerce Pro Add-on allows you to require customers to verify their mobile numbers via OTP during checkout. However, in some cases, you may wish to enable this verification process only for specific products or product categories, leaving the rest of your store free of verification.

This functionality can be easily achieved by using the following hook:

wpsmswoopro_verification_product_restrictions

How to Implement the Hook

Follow the steps below to use the hook effectively.

Step 1: Identify the Products or Categories

You first need to know the Product IDs and Category IDs that you want to limit mobile verification to.

Finding a Product ID:

  • Go to your WordPress Dashboard → Products → All Products.
  • Hover over your desired product, and note the ID in the URL displayed at the bottom-left (e.g., /wp-admin/post.php?post=187&action=edit where 187 is the Product ID).

Finding a Category ID:

  • Navigate to Products → Categories.
  • Hover over your desired category and look at the URL (product_cat&tag_ID=86, where 86 is the Category ID).

Step 2: Use the Hook with Your IDs

Add the following custom snippet to your theme’s functions.php file:

add_filter('wpsmswoopro_verification_product_restrictions', function () {
    return [
        'product_ids'  => [187, 190],   // Replace with your Product IDs
        'product_cats' => [86, 88],    // Replace with your Category IDs
    ];
});

Explanation of Parameters:

  • product_ids: Array of specific products that will trigger mobile verification.
  • product_cats: Array of categories whose products will trigger mobile verification.

Using this simple customization hook, you can effectively manage the OTP mobile verification feature in the checkout, allowing for greater flexibility and improved user experience on your website.