Views contextual filter to a number of product variations
You could try like. First include sku in your view and exclude it from display. Then write this code it would give u desired results.

function modulename_views_query_alter(&amp;$view, &amp;$query)
    {
    if($view-&gt;name=='yourname'){
        preg_match('/.*[^\d+]/',drupal_get_path_alias(),$match);
        $query-&gt;add_where(1,'commerce_product.sku','%'.$match[0].'%','LIKE');
    }
}