• Resolved maryamk7

    (@maryamk7)


    Dear support team,
    by far, you provide the best plugin for editing the checkout page.
    However, I need to know how to access a field. I need to generate an auto order note, I’m using woocommerce hook, and it works fine, but I need to do if statement with one of your field. As you see, I added ‘_billing_select_a_branch’, an id of one of the fields created by your plugin, but it didn’t work at all, it will just generate the ‘test’ note. Please, can you help with this? I just need to access the field and its value.

    add_action( 'woocommerce_new_order', 'add_engraving_notes' );
    function add_engraving_notes( $order_id ) {
    
    $order = wc_get_order( $order_id );
    
    // The text for the note
    // 
    
    if(_billing_select_a_branch == 'juffair')
    $note = 'alraya mall';
    	
    	elseif(_billing_select_a_branch == 'abc')
    $note = 'abc branch';
    	
    	else{
    		$note = 'test';
    	}
    
    // Add the note
    $order->add_order_note( $note );
    
    // Save the data
    $order->save();
    }

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘auto generate order note’ is closed to new replies.