• Resolved frankel95

    (@frankel95)


    Hello,
    I hope you can help me with my problem.
    I am creating a coupon for a specific order status programmatically. Can I set the category of that coupon with code? Cause I want to group them all together, otherwise I have to change the category manually.

    Thank you in advance

Viewing 1 replies (of 1 total)
  • Plugin Support Fauzan Azizie

    (@fauzanade)

    Hi @frankel95,

    Please kindly add this line to your coupon creation snippet:

    wp_set_post_terms($new_coupon_id, $category_id, ‘shop_coupon_cat’);

    Please replace the shop_coupon_cat with your coupon category slug.

Viewing 1 replies (of 1 total)
  • The topic ‘Add category when creating coupon programmatically’ is closed to new replies.