Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › FREE products at PRO version: not updating
- This topic has 16 replies, 3 voices, and was last updated 6 years, 2 months ago by schoihet.
-
AuthorPosts
-
June 7, 2017 at 12:24 pm #1474Juliane DreyerParticipant
Hi there,
I have some problems with the free products at the pro version:
I have 3 free products for choice.
I choose one of the three, and the chosen one is added to cart.
I return to shop, then go back to the cart and change the free selected product.PROBLEM:
–> The previously selected free product stays in the cart, and there is no chance of refreshing the cart amount
–> Also, I cannot delete the free product from the cart so I could change to the new free product
–> If I then click “Checkout”, the previously selected free product is still selectedSo the problem is, once the free product is chosen, I cannot change it. It works if I do something that makes the cart refreshing, but the cart does not refresh automatically if the free product changes… which is quiet annyoing for the customer. Is there any way this can be fixed? Or is something wrong with my implementation or my shop?
Thanks for your help!
June 7, 2017 at 4:31 pm #1476Soft79KeymasterThat’s the way WooCommerce works; changes to the cart are only updated after pressing ‘Refresh cart’.
You could use this jQuery snippet, though:
jQuery( document ).on( 'change input', '.wjecf-select-free-products :input', function() { jQuery('form.woocommerce-cart-form input[name="update_cart"]').click(); } );
Might need some tweaking.
June 8, 2017 at 7:33 am #1478Juliane DreyerParticipantHi Jos,
I know that the cart needs to be refreshed, that’s why I wonder why the plugin does not do this. Because the chosen free product is not applied at the moment. If I am in the cart and chose one of three products, and then click “checkout”, the product is not applied. And if I am in the checkout and chose one of the three products, the product is also not applied. Meaning, it is not working. No free product gets applied unless I somehow manage to refresh the cart, but the user does not know this and there is no message or button like “apply free product to cart”… so how is this feature supposed to work? Or do I miss something?
Thanks again for your help!
June 8, 2017 at 9:22 am #1479Soft79KeymasterThe chose product is applied when ‘Update cart’ is clicked. Just like any other change in the cart.
My plugin does not submit the change by itself, because I don’t want to change the WooCommerce UX too much and it might conflict with certain themes. In the future I might add an option for this.
If you paste javascript snippet in the footer, it will work.
June 8, 2017 at 10:34 am #1480Juliane DreyerParticipantHi Jos,
ok I will give the snippet a try. Just for further development: If it only works with updating cart, the button “Update cart” needs to be enabled. It is disabled now, so the user has no chance of updating it. Same for the checkout, there needs to be a button. By now this feature cannot be used as the user has no chance of applying it to the cart. I understand not changing the WooCommerce UX too much, but if you say the pro plugin has this feature and then it is not working… that is not so good. I don’t want to be rude, I think the rest of the plugin is pretty awesome, but it should work if the plugin feature list says so…
Hope I can fix it with the snippet!
JulianeJune 8, 2017 at 11:22 am #1481Soft79KeymasterCan you please send an url to your store and instructions to reproduce the issue?
Because the ‘update cart’ button should be enabled whenever you click a free item. Also, when checking out the item should be applied when the user clicks the ‘checkout’ button.
June 8, 2017 at 1:42 pm #1484Juliane DreyerParticipantHi Jos,
this is the url:
If you have 5 items from the category “Plüsch” in cart (http://www.kullaloo.de/produktkategorie/pluesch/), you can apply this coupon: freeEbookAb5Pluesch
Note: I have not activated the AUTO coupon at the moment, as the coupon is not working properly…
Before I wrote you the first time, I deactivated all plugins to check whether its something with other plugins that it doesn’t work. I only had WooCommerce and the PRO Plugin active and I also had the Twenty Fourteen activated, not my own theme. But I did not work, the button was still disabled and the product was not applied when checking out.
So maybe you can find the error, would be great!
Thank you, Juliane
June 8, 2017 at 2:08 pm #1486Soft79KeymasterAre you using Internet Explorer by any chance?
It’s working fine on Firefox, but when testing on Internet Explorer I see that the button stays disabled.
Please open this file: wp-content/plugins/woocommerce-auto-added-coupons-pro/includes/pro/WJECF_Pro_Free_Products/js/wjecf-free-products.jsand replace this line:
me.update_totalizer = function( totalizer_id, updated_input = undefined ) {
with:
me.update_totalizer = function( totalizer_id, updated_input) {
Then clear your browser cache and try again. Does that help? If so please let me know, and I implement the fix in the next release.
June 9, 2017 at 10:41 am #1489Soft79KeymasterDid this work for you? Or do you need assistance?
June 9, 2017 at 11:01 am #1490Juliane DreyerParticipantHi Jos,
I am not using IE, I am using Safari. I changed the line of of code like you suggested. This is what’s happening:
The button “refresh cart” is enabled, I can click it and my selection is applied! Cool 🙂
What’s not happening:
If I do not click “update cart” and proceed to checkout, the product is not applied. Is this supposed to work or only by clicking “update cart”? Because you wrote before “Also, when checking out the item should be applied when the user clicks the ‘checkout’ button.”But in the checkout itself is no way of updating the cart? I mean if the user has not chosen the free product before… then is there a way to remove the free product selection from the checkout? Otherwise I will use CSS to simple not display it.
Thanks for your help!
June 9, 2017 at 11:16 am #1491Soft79KeymasterI’m glad the fix worked, I’ll add the fix to the next version.
- On the CART-page ‘Update cart’ must be clicked to append the free product (or use the snippet provided above).
- On the CHECKOUT-page the ‘Select free gift’ will only be displayed if no free product was selected before.
- On the CHECKOUT-page, pressing ‘PLACE ORDER’ will apply the free product.
- If you don’t want to display free product selection on CHECKOUT, you can use CSS or template override. To override the template copy
/wp-content/plugins/woocommerce-auto-added-coupons-pro/checkout/select-free-product.php
to
/wp-content/themes/YOUR_THEME/woocommerce-auto-added-coupons/checkout/select-free-product.php
and delete or edit the contents.
June 9, 2017 at 12:07 pm #1492Juliane DreyerParticipantHi Jos,
the ‘Select free gift’ is always shown on checkout page, no matter if I selected the free product before or not.
I will try adding the jquery. Just one question: I am not very familiar with jquery… how do I put this in an external javascript file? (to load it with wp_enqueue_script)
June 9, 2017 at 3:23 pm #1494Soft79KeymasterHi Juliane,
I just sent you v2.5.3-b1. This fixes the JS error, and also the fact that free product selection was ALWAYS visible on checkout page.
About the jQuery:
– create a new JS file in your child theme (preferably in an assets/js/ directory). Let’s name it my-custom.js
– This contents:jQuery( document ).on( 'change input', '.wjecf-select-free-products :input', function() { jQuery('form.woocommerce-cart-form input[name="update_cart"]').click(); } );
– Enqueue the script with this snippet in functions.php:
function enqueue_my_custom_script() { wp_enqueue_script( 'my-custom-js', get_template_directory_uri() . '/assets/js/my-custom.js', array( 'wjecf-free-products' ) ); }; add_action( 'wp_enqueue_scripts', 'my_custom_script' );
June 12, 2017 at 7:49 am #1497Juliane DreyerParticipantHi Jos,
oh cool, thanks for the update! I replaced the files and it works, I think it is much more usable und less confusing if the selection is hidden from the checkout. Thank you very much for this adjustment!
I also integrated the jquery, and I think it works pretty well except the product is only applied every second click. I tested in Safari and Chrome, in both browsers only every second click forces the cart to update. Any ideas why this is happening?
June 12, 2017 at 8:24 am #1498Soft79KeymasterHmm, maybe because the button is still disabled at the first click.
Try this script instead:
if ( undefined !== jQuery ) { jQuery( function( $ ) { $( document ).on( 'change input', '.wjecf-select-free-products :input', function() { $('form.woocommerce-cart-form input[name="update_cart"]').click(); } ); } ); }
Make sure you clear browsercache before trying.
-
AuthorPosts
- You must be logged in to reply to this topic.