Repository Forums Support WooCommerce Extended Coupon Features PRO Can I require someone to choose a free product?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16528
    andy3
    Participant

    When applying a free item coupon the customer has 4 options to choose from for their Free Gift with Purchase. However, some customers are not picking one for whatever reason. Is there a way to require that they pick a Free Gift With Purchase?

    Thank you,

    Andy

    #16529
    Soft79
    Keymaster

    Currently that’s not possible. This used to be obligatory in older versions of our plugin but I disabled it because it prevented people from checking out.

    If you wish you can ‘hack’ the plugin by uncommenting lines 197 .. 211 of wp-content/plugins/woocommece-auto-added-coupons-pro/pro/plugins/WJECF_Pro_Free_Products.php:

    
    	//Don't checkout if no free gift selected
    	foreach( WC()->cart->get_applied_coupons() as $coupon_code ) {
    	    $coupon = new WC_Coupon( $coupon_code );
    	    //Must the user select a free product?
    	    if ( ! $this->must_select_free_product( $coupon ) ) {
    	        continue;
    	    }
    
    	    $session_selected_products = $this->get_session_selected_products( $coupon_code );
    	    $selected_free_products = $this->count_selected_products( $coupon, $session_selected_products );
    	    if ( empty( $selected_free_products ) ) {
    	        wc_add_notice( __('Please select your free gift.', 'woocommerce-jos-autocoupon'), 'error' );
    	        return;
    	    }
    	}
    

    Please note that this change will be overwritten in case of an update. We’re thinking about implemententing a filter for this functionality in a future version of the plugin.

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