- Beranda
- Komunitas
- Tech
- Website, Webmaster, Webdeveloper
Get product id and sku in template file
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
$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
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan