-
-
Save Alexander-Pop/8b35f7e16e92138e1cea936eb017de9f to your computer and use it in GitHub Desktop.
[get Product URL, Name and ID] get Product URL, get Product Name and get Product ID #magento2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// get current page URL | |
$URL = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]); | |
// get current product name & ID | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product | |
$id = $product->getId(); | |
$title = $product->getName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment