• Resolved andreas22

    (@andreas22)


    Hi,
    As the title suggests i’m creating coupons programmatically and it works great.

    However, i would like to limit some of them to 2 of the discounted product and i can’t find the method for doing so. Can you help me with the right method?

    These are the limitations i’m using so far:

    $coupon->set_individual_use( true );
    $coupon->set_product_ids( array( 10063 ) );
    	  
    $coupon->set_usage_limit_per_user( 1 );
    $coupon->set_usage_limit( 1 );
Viewing 1 replies (of 1 total)
  • Hi @andreas22

    Thanks for reaching out!

    I understand that you are creating coupons programmatically using the custom code snippet above, however, you would like to limit some of them to two of the discounted product.

    This is a bit of a complicated topic that would need some customization to address. Unfortunately, custom coding is not something we can assist with directly. However, I’ll keep this thread open for a bit to see if anyone from the community can lend a hand.

    If you have any other questions related to development or custom coding, don’t hesitate to reach out to some of the great resources we have available for support. The WooCommerce community is filled with talented open-source developers, and many of them are active on the channels listed below:

    Hope this helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Creating coupons programmatically with “Limit usage to X items”’ is closed to new replies.