Coupon ID will also be an integer, so we can switch the prepare statement to expect that

This commit is contained in:
Justin Shreve 2016-08-23 13:55:21 -07:00
parent a243829db6
commit 77088a4a22
1 changed files with 1 additions and 1 deletions

View File

@ -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();