Add the “limit usage to x items” field to follow up generated coupons

Currently any coupon generated by follow up emails is missing the option to set an item limit. This field is present in normal coupons under usage limits when using product or product% type coupons. This missing fields means coupons made by follow up emails are open to abuse and can be used on an infinite number of items in the cart.

Author

Current Status

Open

Last updated: December 19, 2016

6 comments

Log in to comment on this feature request.

  1. Jane Ronald says:

    Yes I agree with your point of view and applied the same thing in https://generatorsadvisor.com/best-quiet-generator-for-camping/ blog page as you can see here.

  2. Anonymous says:

    Anyone have a solution to this?

  3. Noel says:

    Also “active for x payments” for subscription products.

  4. Nick says:

    To anyone still waiting, here’s the backend part. Corresponding part of the plugin is class-fue-coupons.php.

    DB needs to be updated to hold limit_usage_to_x_items value in table _followup_coupons, same as with usage_limit (eg 21 varchar(3) with no default value).

    Changes need to be made to functions:

    1. In add_variable_replacements() add to the rest of update_post_meta() functions:
    update_post_meta( $coupon_id, ‘limit_usage_to_x_items’, $coupon->limit_usage_to_x_items );

    2. In get_coupon_args_from_post() add to $data:
    array(‘limit_usage_to_x_items’ => ( isset( $_POST[‘limit_usage_to_x_items’] ) && ! empty( $_POST[‘limit_usage_to_x_items’] ) ) ? (int) $_POST[‘limit_usage_to_x_items’] : ”)

    3. In get_coupon_data() add to $defaults = array (‘limit_usage_to_x_items’ => ”)

    4. And finally in second $defaults in if ( $coupon ) add to $defaults = array(‘limit_usage_to_x_items’ => $coupon->limit_usage_to_x_items,) }

  5. Rainer Scheerer says:

    ‘+ 1

  6. Monthly Review says:

    Yes, this an obvious oversight that seems like it could be easily remedied.