dupont max Posted July 29, 2024 Share Posted July 29, 2024 Hello, I want to get product_id in custom js file with javascript or jquery, This is path of custom js file : \themes\theme_name\assets\js\custom.js I have already get product_id in tpl file and it working fine but in javascript there not working, i have undefined value Thanks. Link to comment Share on other sites More sharing options...
Nickz Posted July 29, 2024 Share Posted July 29, 2024 post the entire error, or at least the first 2 lines of it. Link to comment Share on other sites More sharing options...
dupont max Posted July 30, 2024 Author Share Posted July 30, 2024 Hello, I success managed to retrieve the variables in the javascript code from the TPL code In fact the idea is to disable the add cart button dynamically, instantly without reloading the page when the quantity in the basket is greater than the quantity in stock To avoid excess orders in addition to stock. I put this tpl code in this file \themes\nomtheme\templates\catalog\_partials\product-add-to-cart.tpl : and i put javascript code in this file \themes\nomtheme\assets\js\custom.js But it does not work How to solve this problem ? Thank you in advance for your help. Link to comment Share on other sites More sharing options...
dupont max Posted July 30, 2024 Author Share Posted July 30, 2024 (edited) it working thanks a lot everyone !!!! Edited July 30, 2024 by dupont max (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now