Temanın function.php dosyası içerisine aşağıdaki kodları ekleyin ;


// Add a custom product note below product meta in single product pages
add_action('woocommerce_single_product_summary', 'custom_product_note', 100 );
function custom_product_note() {

echo '
';

woocommerce_form_field('customer_note', array(
'type' => 'textarea',
'class' => array( 'my-field-class form-row-wide') ,
'label' => __('Product note') ,
'placeholder' => __('Add your note here, please…') ,
'required' => false,
) , '');
echo '
';

//
?>
<script>
jQuery( function($){
$('#customer_note').on( 'input blur', function() {
$('#product_note').val($(this).val());
});
});
</script>

}

// Custom hidden field in add to cart form
add_action( 'woocommerce_before_add_to_cart_button', 'hidden_field_before_add_to_cart_button', 5 );
function hidden_field_before_add_to_cart_button(){
echo '';
}

// Add customer note to cart item data
add_filter( 'woocommerce_add_cart_item_data', 'add_product_note_to_cart_item_data', 20, 2 );
function add_product_note_to_cart_item_data( $cart_item_data, $product_id ){
if( isset($_POST['product_note']) && ! empty($_POST['product_note']) ){
$product_note = sanitize_textarea_field( $_POST['product_note'] );
$cart_item_data['product_note'] = $product_note;
}
return $cart_item_data;
}