Can’t get custom fields values programmatically
-
Hi!
I try to get value of fields this way:add_action( 'woocommerce_checkout_order_processed', 'action_function_apinetua' ); function action_function_apinetua( $order_id ){ $order = wc_get_order($order_id); $order_data = $order->get_data(); $urlMySite = 'https://tennis.com.ua'; $orderUrl = '=HYPERLINK("'.$urlMySite.'/wp-admin/post.php?post='.$order_id.'&action=edit";"'.$order_id.'")'; // Номер заказа $phone = $order_data['billing']['phone']; $first_name = $order_data['billing']['first_name']; $last_name = $order_data['billing']['last_name']; $priceTotal = str_replace('.',',',$order_data['total']); $payment_method = $order_data['payment_method'] == 'cod' ? 'НП получатель' : 'Получатель'; $city = str_replace('город ','',$order_data['shipping']['city']); // Город $address = $order_data['shipping']['address_1']; $email = $order_data['billing']['email']; $wcity = $order_data['billing']['wcity']; // Custom field $street = $order_data['billing']['street']; // Custom field $house = $order_data['billing']['house']; // Custom field if (!$address AND !$wcity) $payment_method = 'Самовывоз';
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Can’t get custom fields values programmatically’ is closed to new replies.