• Resolved sukalo

    (@sukalo)


    Is it possible to improve the quote description text box to a WYSIWYG editor so we can add more customisation to the area.

    My use case is for the quotes contract terms so would like to be able to improve visually using html / editor.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @sukalo

    Converting the quote description?field into a rich Textbox is not possible as it’s a WordPress excerpt field and meant to be shown that way.

    but you can create a custom description field using the below code.

    You can add this code to your child theme functions.php file or you can use a plugin like code snippet.

    add_action( 'add_meta_boxes', 'adding_a_new_metaabox' );                
    function adding_a_new_metaabox() {   
        add_meta_box('html_myid_31_section', 'Quote Description', 'gd_buddy_output_func', 'wpi_quote' );
    }
    
    function gd_buddy_output_func( $post ) {
        //so, dont ned to use esc_attr in front of get_post_meta
        $valueeee2=  get_post_meta($_GET['post'], 'gd_buddy_quote_description' , true ) ;
        wp_editor( htmlspecialchars_decode($valueeee2), 'gd_buddy_quote_description_field', $settings = array('textarea_name'=>'gd_buddy_quote_description') );
    }
    
    
    function save_my_post_data( $post_id ) {                   
        if (!empty($_POST['gd_buddy_quote_description'])) {
            $datta = htmlspecialchars($_POST['gd_buddy_quote_description']);
            update_post_meta($post_id, 'gd_buddy_quote_description', $datta );
        }
    }
    add_action( 'save_post', 'save_my_post_data' ); 
    
    
    /**
     * Display invoice description before line items.
     *
     * @param WPInv_Invoice $invoice
     */
    function getpaid_gd_buddy_quote_description( $invoice ) {
        $quote_id = $invoice->get_id();
        if ( !empty( $quote_id ) ) {
            $content = html_entity_decode( get_post_meta( $quote_id, 'gd_buddy_quote_description' , true ) );
            echo wp_kses_post( wpautop( $content ) );
        }
    }
    add_action( 'getpaid_invoice_line_items', 'getpaid_gd_buddy_quote_description', 100 );
    add_action( 'wpinv_email_billing_details', 'getpaid_gd_buddy_quote_description', 100 );

    This code will add a new description field inside quotes and you can add html in it.

    https://ibb.co/4KwBKY0

    Regards

    Thread Starter sukalo

    (@sukalo)

    Thank you, much appreciated

    Glad, have a good day.

    Thread Starter sukalo

    (@sukalo)

    Do you happen to have the same for Invoices too please, I used ACF but it doesn’t display the data in emails sent.

    It might be that ACF is saving the custom fields after the invoice has been sent to the customer.

    Try this:- https://wordpress.stackexchange.com/a/58305

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Improve Quote Description Section’ is closed to new replies.