Skip to content
Advertisement

Enhanced WooCommerce Custom Fields for Variations

Using the Remi Coulson tutorial, a custom field has been added for product variations.

This works, however the custom field is positioned by the add-to-cart button. I wish to position it within Additional Information tab. I have tried adding the front end code to the additional-information.php but it does not display.

JavaScript

Added to functions.php to display variation

JavaScript

Advertisement

Answer

Note that your code is a bit outdated since WooCommerce 3.

jQuery and some other changes are required to display the selected variation custom field value anywhere in a specific location on single product pages, specially outside the variation form.

In the example below the selected variation custom field value will be displayed on “Additional information” product tab after product attributes table.

Here is the complete revisited code:

JavaScript

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement