• Resolved kader20031

    (@kader20031)


    I am new to php, and I am trying to change some of the order details before it is going to data base, I want to make sure that this code is safe,
    how it can be checked ?

    function update_billing_address_2_from_company( $order_id ) {
        if ( pll_current_language() === 'he' ) {
            $order = wc_get_order( $order_id );
            $billing_company = $order->get_billing_company();
    		$first_name  = $order->get_billing_first_name();
            //because of a bug, overwrite billing addres_2
    		if (!empty( $billing_company)) {
                $order->set_billing_address_2( $billing_company );
    			$order->save();
            }
    		//set company name as first name 
    		if (!empty( $first_name )){
                $order->set_billing_company( $first_name );
    			$order->save();
            }		
        }
    }
    add_action( 'woocommerce_checkout_update_order_meta', 'update_billing_address_2_from_company', 10, 1 );

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘manipulate data from user in checkout page, safe php code ?’ is closed to new replies.