Magento 2 Transfer Ordered Downloadable Product from One Customer to Another

As e-commerce merchants sometimes we got called from customer to transfer their purchased downloadable products from one account to another account and unfortunately, there is no way to do this in native Magento. As Magento 2 developer we got the same requirements like one customer purchased a downloadable product from the Magento 2 website from their email ID and that customer no longer works with that company and their email ID also no more exist, so that company manager contact us to transfer that downloadable product link to another active customer account and we did in Magento directly updating the customer ID from the database.

Continue reading “Magento 2 Transfer Ordered Downloadable Product from One Customer to Another”

Magento 2 Add JavaScript with Tag Attribute From Block File

If you are looking for a way to include JavaScirpt with a tag attribute from the block file in Magento 2 then this blog post shows you exactly what you are looking for. Sometimes the JavaScript link is different as per admin config values. Also, JavaScript has different data tag values as per admin config values, at that time, this is the best way to include JS from the Block file to the front end.

Continue reading “Magento 2 Add JavaScript with Tag Attribute From Block File”

How to Whitelist Inline Script for CSP | Content Security Policies

Content Security Policy is an extra layer of security to reduce attacks of Cross-Site Scripting. Magento supports CSP from Magento 2.3.5 version. Magento_Csp native module has logic in Magento to manage the CSP. In Magento, if you want to whitelist any script and style then you can easily do it by creating one file csp_whitelist.xml under your custom module’s \etc directory and then you can add any script and style to that file and that script and style which will be bypassed from CSP. Click here to check the csp_whitelist.xml sample file.

Continue reading “How to Whitelist Inline Script for CSP | Content Security Policies”

Magento 2 Get Vault Payment Token from Order

If Magento 2 website has a feature to save credit cards for future use, then in reality, full credit card data is never saved to Magento database, but each payment gateway generates one token for the credit card and Magento saves that payment token.

Sometimes merchant wants to fetch that saved payment token with an order and pass that payment token to some ERP or somewhere else then you can get that payment token using order data.

Continue reading “Magento 2 Get Vault Payment Token from Order”