Repository Forums Support WooCommerce Extended Coupon Features PRO Select free gift programitically

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #15290
    info17
    Participant

    How to select free gift programmatically using hook or something?

    #15291
    info17
    Participant

    Is this still usable on current version?
    https://www.soft79.nl/forums/topic/obtain-coupon-info/#post-749
    WJECF()->get_plugin('WJECF_Pro_Free_Products')->set_session_selected_product( $coupon_code, $product_id )

    #15300
    Soft79
    Keymaster

    Yes, but verify that get_plugin doesn’t return null, for example when it’s disabled in debug mode.

    #15301
    info17
    Participant

    So… what’s the best way to do it?

    #15302
    Soft79
    Keymaster

    I suggest you take a look at the source code of the ‘free products’-plugin to see how the plugin does it.

    #15303
    info17
    Participant

    Actually I tried WJECF()->get_plugin(‘WJECF_Pro_Free_Products’)->set_session_selected_product and had critical error.
    Is it still alive?

    #15304
    Soft79
    Keymaster

    I checked the source code; it’s a private function so no, unfortunately you can’t use it. Really, all the info you need is in the source. We support the plugin but we are not a helpdesk for extensive custom development.

    #15305
    info17
    Participant

    Would you add it to api like “get_session_selected_product” in future release?

    #15306
    Soft79
    Keymaster

    No plans for that.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.