function cfwc_create_custom_field() { $args = array( 'id' => 'custom_text_field_title', 'label' => __( 'Levertijd info', 'cfwc' ), 'class' => 'cfwc-custom-field', 'desc_tip' => true, 'description' => __( 'Levertijd info.', 'ctwc' ), ); woocommerce_wp_text_input( $args ); } add_action( 'woocommerce_product_options_general_product_data', 'cfwc_create_custom_field' ); function cfwc_save_custom_field( $post_id ) { $product = wc_get_product( $post_id ); $title = isset( $_POST['custom_text_field_title'] ) ? $_POST['custom_text_field_title'] : ''; $product->update_meta_data( 'custom_text_field_title', sanitize_text_field( $title ) ); $product->save(); } add_action( 'woocommerce_process_product_meta', 'cfwc_save_custom_field' ); function cfwc_display_custom_field() { global $post; // Check for the custom field value $product = wc_get_product( $post->ID ); $title = $product->get_meta( 'custom_text_field_title' ); if( $title ) { // Only display our field if we've got a value for the field title printf( '<div class="cfwc-custom-field-wrapper"><label for="cfwc-title-field">%s</label></div>', esc_html( $title ) ); } } add_action( 'woocommerce_before_add_to_cart_button', 'cfwc_display_custom_field' );
In case of any complain or © copyright or issues please check disclaimer page for faster resolutions.
Why should you use Cloudways?
Cloudways hosting Web hosting is an essential service for any internet-based or internet-interfaced business. Whetherread more...
E-commerce webshop
E-commerce is a booming industry worldwide. The advent of the internet and the rapid, sustainedread more...
WP Rocket is the best way to boost your site
WP Rocket Plugin WP Rocket is a WordPress plugin that facilitates faster page loads andread more...
Het snelste en beste webshopplatform Woocommerce
In case of any complain or © copyright or issues please check disclaimer page forread more...
Wat is het verschil tussen UX en UI?
UI-design en UX-design In de wereld van webdesign, maar ook in het ontwikkelen van softwareread more...
Create a multilingual wordpress site
Translatepress plug-in The internet is truly global in nature. An internet user in the Netherlandsread more...
Search engine optimization by Yoast
Yoast Plugin Search Engine Optimization (SEO) can be a very technical field. It is alsoread more...
Block malicious web traffic
Sucuri firewall The internet is full of malicious actors. There are low-level annoyances like “scriptread more...
Google analytics is a free service provided by Google
Google Analytics Google analytics is a free service provided by Google that helps webmasters, siteread more...
Every website needs hosting
SiteGround hosting Every website needs hosting. Unless you happen to operate a web hosting agency,read more...
Verify that Google can find your page
Google Search console Google Search Console is a free tool from Google that helps youread more...