diff --git a/includes/api/class-wc-rest-coupons-controller.php b/includes/api/class-wc-rest-coupons-controller.php index 3fbd1df064e..dfd1103d438 100644 --- a/includes/api/class-wc-rest-coupons-controller.php +++ b/includes/api/class-wc-rest-coupons-controller.php @@ -207,7 +207,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller { // ID. if ( isset( $request['id'] ) ) { - $code = $wpdb->get_var( $wpdb->prepare( "SELECT post_title FROM $wpdb->posts WHERE id = %s AND post_type = 'shop_coupon' AND post_status = 'publish'", $request['id'] ) ); + $code = $wpdb->get_var( $wpdb->prepare( "SELECT post_title FROM $wpdb->posts WHERE id = %d AND post_type = 'shop_coupon' AND post_status = 'publish'", $request['id'] ) ); $coupon = new WC_Coupon( $code ); } else { $coupon = new WC_Coupon();