How to load a commerce product in Drupal 9

Product object can be accessed,
By loading the product id.

Include the Product class

use Drupal\commerce_product\Entity\Product;

To get Product object using Product Id,

$pid = 'Product Id';

$product = Product::load($pid);

To access Product Variation,

Include the ProductVariation class

use Drupal\commerce_product\Entity\ProductVariation;

To get a Variation object using Variation,

$vid = 'Variation Id';

$variation = ProductVariation::load($vid);

Category