• Resolved brankoads

    (@brankoads)


    Hi, great plugin.

    I added a couple of coupons (names: 1, 2, 3; – > Individual use only: Yes; Auto coupon: Yes; Usage limit per coupon: 1; and Usage limit per user: 1;).

    When someone go to cart, your plugin must to apply coupon named: 1. When one customer use that coupon… another user when go to cart your plugin need to apply second coupon named: 2… etc.

    The order of coupons that are now using is random(2, 1, 3.. or 6, 7, 5 etc…). How to setup to use order ASC (1,2,3,4,5,….)?

    Thanks in advance!

    https://www.ads-software.com/plugins/woocommerce-auto-added-coupons/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter brankoads

    (@brankoads)

    If anyone can help??

    Plugin Author Soft79

    (@josk79)

    Hi! You can achieve this by changing a bit of code.

    At the end of woocommerce-jos-autocoupon.php you will find:

    $query_args = array(
    	'posts_per_page' => -1,
    	'post_type'   => 'shop_coupon',
    	'post_status' => 'publish',
    );

    append orderby and order, like this:

    $query_args = array(
    	'posts_per_page' => -1,
    	'post_type'   => 'shop_coupon',
    	'post_status' => 'publish',
    	'orderby' => 'title',
    	'order' => 'desc',
    );

    This will order the coupons by the couponcode (title). I might fix this in a future version.

    See <a href=”https://codex.www.ads-software.com/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
    “>this page for available orderby-parameters.

    Plugin Author Soft79

    (@josk79)

    I fixed this in v1.1.2. Coupons will be ordered by title.

    Thread Starter brankoads

    (@brankoads)

    Hi Josk79,

    Great, thanks!

    Is there a hook that can help me to display one coupon value on product page? I want that customer can be seen immediately on a detailed product page value of coupon (discount).

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘order auto coupons ASC’ is closed to new replies.