Repository Forums Support WooCommerce Extended Coupon Features PRO customer must choose from the free products

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19792
    Mushfig Guliyev
    Participant

    I want that my customer can choose 2 or 3 free products. When i set Check this box if the customer must choose from the free products- customer can choose only one product

    #19794
    Soft79
    Keymaster

    When you check ‘allow multiplication’ the amount of products that can be chosen will be set to the number of times the minimum restrictions apply. E.g. if ‘minimimum subtotal’ is $100 and the cart contains $200 then 2 products can be chosen.

    #19795
    Mushfig Guliyev
    Participant

    If my product 2399$ when i set minumum subtotal 100$ my customer can choose over 2 product, but i want that my customer can set maximum 2 priducts. Also how can i set this with radio or checkbox function?

    #19798
    Soft79
    Keymaster

    To set the maximum number of free items to 2, paste this snippet in your child theme’s functions.php:

    
    add_filter(
      'wjecf_free_product_amount_for_coupon',
      function ( $amount, $coupon ) {
        if ( strcasecmp( $coupon->get_code(), 'THE_COUPON_CODE' ) === 0 && $amount > 2 ) {
          $amount = 2;
        }
        return $amount;
      },
      10,
      2
    );
    
    

    To use checkboxes in the form:
    Copy wp-content/plugins/woocommere-auto-added-coupons-pro/templates/coupon-select-free-product.php to wp-content/themes/YOUR_CHILD_THEME/woocommere-auto-added-coupons/coupon-select-free-product.php and replace

    $input_type = $allow_multiple_products ? 'number' : 'radio';

    with

    $input_type = $allow_multiple_products ? 'checkbox' : 'radio';

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