• Resolved splaquet

    (@splaquet)


    We’d like to offer a free product on our 3rd recovery email. While we’re able to modify the generated link to automatically add a product to the cart, the problem we’ll have (with the current plugin coupon feature) is that the customers could easily remove the product from the cart and use that discount on their existing order (because we can’t actually limit the coupon to specific products from within your plugin).

    Your plugin is GREAT, but would love to find a way to take things to the next level (without having to go in and manually modify code.)

    Please feel free to hit me back with any questions, as I had to draft this up in a hurry… as I’m running out the door.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support CartFlows Team

    (@cartflows)

    Hello @splaquet,

    Thank you for reaching out to us.

    We know adding the custom code is not suitable for all users, but for now, the functionality you are looking for is possible with the custom code.

    Here is the custom code:

    add_filter('woo_ca_generate_coupon', 'update_coupon_options');
    
    function update_coupon_options( $coupon_post_data ){
    
       $coupon_post_data['product_ids'] = array('product ID');
    
        return $coupon_post_data;
    }

    It allows you to choose the products that must be in the cart for the discount to be applied by adding the product IDs inside the two single quotes.

    Note: Please add the above code in the function.php file of the child theme.

    We will try to add this option in email template settings in our future updates to configure it in the same.

    Let us know if you have any questions.

    Thread Starter splaquet

    (@splaquet)

    thank you kindly for that quick and efficient solution!

    …but, that kinda leads to my next question. When I add the “add this product to cart” code in the URL, the url generated in the plugin is redirecting the actual URL, and ultimately adds 2 products to the cart.

    here’s what i’m using:
    {{cart.checkout_url}}&add-to-cart=3293

    but, the generated link ends up adding 2 of the product. i’m assuming that it’s our theme that’s reloading the checkout page:
    https://domain.shop/checkout/?wcf_ac_token=d2NmX3Nlc3Npb25faWQ9ZHVtbXktc2Vzc2lvbi1pZCZ3Y2ZfcHJldmlld19lbWFpbD0x&add-to-cart=3293

    BUT, this link DOES NOT add 2 products to the cart (only 1, as expected):
    https://domain.shop/cart/?wcf_ac_token=d2NmX3Nlc3Npb25faWQ9ZHVtbXktc2Vzc2lvbi1pZCZ3Y2ZfcHJldmlld19lbWFpbD0x&add-to-cart=3293

    any suggestions on how to work around that?

    Plugin Support CartFlows Team

    (@cartflows)

    Hello There,

    When you use the checkout page link, the plugin adds the product in the cart that was abandoned. So if you are adding the same product, it will be twice.

    When you redirect the users to the cart page, the plugin does not add products to the cart.

    Is the same product you adding?

    Just to let you know, you can also specify the quantity in the URL with the add to cart. So it might solve your problem.
    Here is the article link for the same:
    https://www.businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/

    Let us know if you have any questions.

    Thread Starter splaquet

    (@splaquet)

    my apologies! turns out we had a plugin that refreshed the checkout page. i disabled the refresh on checkout page, and the link works as expected.

    while i’m seeing that the link automatically applies the coupon code, that code snippet from above isn’t limiting the coupon’s usage to the product ID that i set.

    as in, i can add the product with:
    {{cart.checkout_url}}&add-to-cart=3293

    but the coupon stays active if i were to remove the free product.

    ##

    also, not sure if it’s by design or not, but our product is $5.20 (currently on sale)… but when i enter 5.20 into the fixed discount field, it says:
    "Please enter a valid value. The two nearest values are 5 and 6."

    any workarounds for that?

    Plugin Support CartFlows Team

    (@cartflows)

    Hello @splaquet,

    Have you enabled the auto-apply coupon in email settings? If yes, please disable it and check if the coupon is working fine.

    Regarding the second concern, you must add the integer value to the discount value. Float value will not work.

    Hope it clarifies. Let us know if you have any questions.

    Thread Starter splaquet

    (@splaquet)

    bummer about the coupon not having decimal options. if the coupon generation process limited the coupon for use ONLY on PRODUCT, i’d say it’d be safe to use 100%.

    auto-apply coupon IS checked off. the coupon generates correctly, it applies to the cart correctly, but the code snippet you provided (above) is not limiting the coupon’s use to the product ID that we set.

    to confirm, this was how it was supposed to be used?

    add_filter('woo_ca_generate_coupon', 'update_coupon_options');
    function update_coupon_options( $coupon_post_data ){
       $coupon_post_data['product_ids'] = array('3293');
        return $coupon_post_data;
    }
    Plugin Support CartFlows Team

    (@cartflows)

    Hello @splaquet,

    Can you please check one of the coupons generated through our plugin with the custom code in the Coupon section of Woocommerce? Check if the product ids include the value.

    Looking forward to hearing from you.

    Plugin Support CartFlows Team

    (@cartflows)

    Hello @splaquet,

    Since we haven’t heard back from you here, we will go ahead and close out this thread.

    Feel free to start a new thread if you have further issues.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Free Product w/ recovery (not flat or %)’ is closed to new replies.