Support » Plugin: Smart Coupons for WooCommerce » Make “Show in My account” auto-enabled

  • Resolved arminghasemazar

    (@arminghasemazar)


    Hi.

    Is there any way to automatically enable “Show in My account” option for each newly generated coupon? (basically for all coupons) I’ve some plugins which create coupons based on some criteria. But for each coupon being created, I need to manually enable the “Show in My account” option.

    Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author webtoffee

    (@webtoffee)

    Hi @arminghasemazar,

    You can use the custom code below to enable the option by default for all coupons. Copy the code snippet to your active theme’s functions.php

    add_action('save_post','wt_make_the_coupon_available_my_account', 10,1);
    function wt_make_the_coupon_available_my_account( $post_id ) {
    if( 'shop_coupon' == get_post_type($post_id) ) {
    update_post_meta($post_id, '_wt_make_coupon_available_in_myaccount',  true );
    }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Make “Show in My account” auto-enabled’ is closed to new replies.