How to Add Filed in Single Product Page In WordPress
This code use for you can add files to your Single Product page, and this code adds your function.php
file WordPress.
<?php add_action( 'woocommerce_product_options_general_product_data', 'woocom_general_product_data_custom_field' ); function woocom_general_product_data_custom_field() { // Create a custom text field // Text Field woocommerce_wp_text_input( array( 'id' => '_new_regular_price', 'label' => __( 'New Regular Price', 'woocommerce' ), 'placeholder' => 'New Regular Price', 'desc_tip' => 'true', 'description' => __( 'Regular Price', 'woocommerce' ) ) ); } add_action( 'woocommerce_process_product_meta', 'woocom_save_general_proddata_custom_field' ); function woocom_save_general_proddata_custom_field( $post_id ) { $text_field = $_POST['_new_regular_price']; if( ! empty( $text_field ) ) { update_post_meta( $post_id, '_new_regular_price', esc_attr( $text_field ) ); } } ?>
Author: Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.
Trending Posts
Tags
ACF
Ading custom columns
admin
Bootstrap
Cart Price
categories
Change Price
class
Code
comments
Create
Creating custom post Type
CSS
current
custom
Customizing
Custom Post
Custom Post Type
Custom Taxonomy
database
Date
Fatch
form
function
HTML
Image
Install
javascript
jQuery
Menu
PHP
Post
Post Type
Price
product
responsive
Resular price
Single product
Table
taxonomy
Theme
Title
woocommerce
Wordpress
Wordpress Code