Coupon ID will also be an integer, so we can switch the prepare statement to expect that
This commit is contained in:
parent
a243829db6
commit
77088a4a22
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue