WooCommerce get_price returning wrong price when used via ajax
It’s important to exit the function when using the wp_ajax hooks. Hopefully this fixes it. function get_ticket_price() { $ticketID = $_REQUEST[‘ticketID’]; echo wc_get_product( $ticketID )->get_price(); // Don’t forget to stop execution afterward. wp_die(); } add_action( ‘wp_ajax_get_ticket_price’, ‘get_ticket_price’ ); add_action( ‘wp_ajax_nopriv_get_ticket_price’, ‘get_ticket_price’ );