How to get a product variant by SKU and get parent product details as well? I need to get a product variant as an object in Twig, as well as get its parents details (the product fields, not just the variant fields). My first guess starts with this:

{% set variant = craft.commerce.products.sku('my-sku-number') %}


But that doesn't work. I've also tried adding a the .first() limiter to the end. What am I missing?

Edit

Thoughts... should I be trying a search/find?
Untested, but something like this should work:

{% set products = craft.commerce.products({
  hasVariant: {sku: 'my-sku-number'}
}).first() %}


See: https://craftcommerce.com/docs/craft-commerce-products#hasvariant

If you only want to search the default variant of the product:

{% set products = craft.commerce.products({defaultSku : 'my-sku-number'}).first() %}


See: https://craftcommerce.com/docs/craft-commerce-products#defaultsku