Home › Forums › General Issues › Automatic Calculation price per kilo › Reply To: Automatic Calculation price per kilo
Hi, Nayrod!
Have you already created the ‘price_per_kilo’ field in the ACF fields for products?
If you change files in the plugin folder itself, then after the update all edits will disappear. So you need a new folder in your theme folder.
You need to create a new folder in your theme. Like this directory
/ wp-content / themes / your-child-theme / woocommerce / single-product /
Copy the price.php template from the / wp-content / plugins / woocommerce / templates / single-product directory to your new folder (/ wp-content / themes / your-child-theme / woocommerce / single-product /)
Open the price.php template and paste my code (don’t duplicate the global $product).
If the code doesn’t work try this. Оpen the product in the admin panel. An empty “price_per_kilo” field that you created at the beginning should appear. Make sure the price and weight (in delivery) are specified. Save the product. Go to the front-end of the product page, the code should work.
If there are any mistakes, write down which ones. Write down, step by step, what you are doing and in which files.
It works in my local project. Good luck!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.