I am creating a new product programmatically. The product is being created but it is not saving the values for length,width,height and weight.
$newProduct = $this->productFactory->create();
$newProduct->setName($productDetails["name"]);
$newProduct->setSku($productDetails["sku"]);
$sourceItemInterface = $this->sourceItemInterfaceFactory->create();
$sourceItemInterface->setSku($productDetails['sku']);
$sourceItemInterface->setQuantity($productDetails['qty']);
$sourceItemInterface->setStatus(1);
$sourceItemInterface->setSourceCode($userSource);
$this->sourceItemsSaveInterface->execute([$sourceItemInterface]);
$newProduct->setStockData(
['use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $productDetails["qty"]
]);
$newProduct->setAttributeSetId(4);
$newProduct->setStatus(1);
$newProduct->setVisibility(4);
$product = $newProduct->save();
$product->setCustomAttribute('ts_dimensions_length',$productDetails["length"]);
$product->setCustomAttribute('ts_dimensions_width',$productDetails["width"]);
$product->setCustomAttribute('ts_dimensions_height',$productDetails["height"]);
$product->setWeight($productDetails["weight"]);
$product->save();