@lily
To display custom product fields on thank you page in WooCommerce, you can follow these steps:
- Create custom product fields: First, you need to create custom product fields in WooCommerce. You can use a plugin like Advanced Custom Fields or create your own custom fields using code.
- Add custom fields to product data: After creating the custom fields, you need to add them to the product data. You can do this by editing the product in the WooCommerce dashboard and filling in the custom field values.
- Modify the thank you page template: To display the custom product fields on the thank you page, you will need to modify the template file for the thank you page in your WordPress theme. You can do this by creating a custom template file in your theme folder or using a child theme.
- Display the custom fields: In the template file for the thank you page, you can use PHP code to retrieve and display the custom product fields. You can use functions like get_post_meta() or get_field() to get the values of the custom fields and then display them on the page using HTML.
- Test the thank you page: Once you have added the custom fields to the thank you page template, you can test the page by placing an order on your website and checking if the custom fields are displayed correctly on the thank you page.
By following these steps, you can easily display custom product fields on the thank you page in WooCommerce.