0

I'm still new at Magento and im trying to work on something where I need to pass the product SKU from a file that has a function that retrieves the product SKU to another file with no such function, within the same Module.

In the first file Vendor_name/Module_name/Block/Catalog/Product/File_name.php, a function exists that retrieves a SKU like so:

$sourceItems = $getSourceItemsBySkuInstance->execute((string)$product->getSku());

But, in the other file, located in, Vendor_name/Module_name/Block/File_name.php, no such function exists.

So, how can I pass the $product->getSku() with its value to the 2nd file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.