Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Select free gift programitically
How to select free gift programmatically using hook or something?
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 )
WJECF()->get_plugin('WJECF_Pro_Free_Products')->set_session_selected_product( $coupon_code, $product_id )
Yes, but verify that get_plugin doesn’t return null, for example when it’s disabled in debug mode.
So… what’s the best way to do it?
I suggest you take a look at the source code of the ‘free products’-plugin to see how the plugin does it.
Actually I tried WJECF()->get_plugin(‘WJECF_Pro_Free_Products’)->set_session_selected_product and had critical error. Is it still alive?
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.
Would you add it to api like “get_session_selected_product” in future release?
No plans for that.