Title: PHP Warning: Undefined variable $variation_id
Last modified: February 25, 2026

---

# PHP Warning: Undefined variable $variation_id

 *  [acwporg](https://wordpress.org/support/users/acwporg/)
 * (@acwporg)
 * [3 months, 2 weeks ago](https://wordpress.org/support/topic/php-warning-undefined-variable-variation_id/)
 * Hello again,
 * So I have a client site whose logs are full of this warning. It seems that it’s
   breaking the checkout process for our wholesale clients when using credit card.
 * `PHP Warning: Undefined variable $variation_id in /home/website/public_html/wp-
   content/plugins/whols/includes/functions.php on line 1287`
 * Version is 2.4.6 – Line 1287 is the bolded line here:
 *     ```wp-block-code
          function whols_is_wholesale_priced( $product_id, $qty ){$product_data = wc_get_product($product_id); if($product_data->is_type('simple')){        $product_id     = $product_data->get_id();        $variation_id   = '';    } elseif( $product_data->is_type('variation') ){        $product_id     = $product_data->get_parent_id();        $variation_id   = $product_data->get_id();    }    $wholesale_status    = whols_is_on_wholesale( $product_id, $variation_id );    $enable_this_pricing = $wholesale_status['enable_this_pricing'];    $price_value         = $wholesale_status['price_value'];    $minimum_quantity    = $wholesale_status['minimum_quantity'];    if( whols_is_wholesaler(get_current_user_id()) && $enable_this_pricing && $price_value &&  $qty >= $minimum_quantity  ){        // Returned array in case we need to pass any other data in the future        return array(            'wholesale_priced' => 'yes'        );    }    return false;}
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Zenaul Islam](https://wordpress.org/support/users/zenaulislam/)
 * (@zenaulislam)
 * [3 months, 1 week ago](https://wordpress.org/support/topic/php-warning-undefined-variable-variation_id/#post-18832956)
 * Hi [@acwporg](https://wordpress.org/support/users/acwporg/),
 * Thank you for contacting us. We apologize for the inconvenience this has caused.
 * We have resolved the issue in version **2.4.7**. Please update the plugin and
   check your site again. If you continue to experience any issues, feel free to
   contact us anytime.
 * Best Regards,
    Zenaul Islam
 *  Thread Starter [acwporg](https://wordpress.org/support/users/acwporg/)
 * (@acwporg)
 * [3 months, 1 week ago](https://wordpress.org/support/topic/php-warning-undefined-variable-variation_id/#post-18835811)
 * updated, thanks very much

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-undefined-variable-variation_id%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/whols/assets/icon-256x256.png?rev=3260538)
 * [Whols – Wholesale Prices and B2B Store Solution for WooCommerce](https://wordpress.org/plugins/whols/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/whols/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/whols/)
 * [Active Topics](https://wordpress.org/support/plugin/whols/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/whols/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/whols/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [acwporg](https://wordpress.org/support/users/acwporg/)
 * Last activity: [3 months, 1 week ago](https://wordpress.org/support/topic/php-warning-undefined-variable-variation_id/#post-18835811)
 * Status: not resolved