Changing the product regular_price for WC REST API v2 output
<?php
// the code below goes in your functions.php file
function my_custom_prepare_shop_order_object($response, $order, $request) {
if( is_pos() ) {
$data = $response->get_data();
$data['regular_price'] = get_post_meta( $data['id'], 'wholesale_customer_wholesale_price', true );
$response->set_data($data);
}
return $response;
}
add_filter( 'woocommerce_rest_prepare_product_object', 'my_custom_prepare_product_object', 20, 3 );
add_filter( 'woocommerce_rest_prepare_product_variation_object', 'my_custom_prepare_product_object', 20, 3 );