daniel8115Avatar border
TS
daniel8115
Get product id and sku in template file
Use the below script to get the product by id and SKU in the template file.
$id = YOUR_PRODUCT_ID;
$sku = 'YOUR_PRODUCT_SKU';
$_product = $block->getProductById($id);
$_product = $block->getProductBySku($sku);
echo $_product->getEntityId();
echo '<br />';
echo $_product->getName();

If you have any queries about the article or any questions in general, use the comment section below!
End Step 2 Get product id and SKU in template file in Magento 2

0
1.5K
0
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan