Latest Version Causes Cart Issue
-
Good Afternoon,
After updating to the latest version of this plugin, it actually causes an issue with our cart, whereas if we have items in the cart and we click clear cart on our WP Ecommerce cart, the items are still displayed in the WP mini cart.
However if we reload the page manually by right clicking the mouse button and clicking reload, the mini cart will then empty.
Have downgraded to the previous version of WP Menu cart, and everything is back to working as normal.
We are using the WP Ecommerce plugin, which I know hasn’t been tested with your plugin for a while.
Any help, would be very much appreciated, as you have a great plugin!
Kind Regards,
Andy
- This topic was modified 3 years, 2 months ago by Andrew1977.
-
Hello Andy,
There were no code changes in the last update other than that we moved some files to a different folder (for example files from the folderjavascript
were moved toassets/js
) and we added minified versions of the scripts and styles (.min.js
and.min.css
).
Is it possible that your site is still loading a cached version of the previous scripts (or rather, looking for the scripts in the old location from cached pages)? If you could provide a link to the site where we can see this in action, we could also see if the latest script versions are being loaded.Hello Ewout,
Thank you for your speedy reply.
One thing I forgot to mention, we had made some changes to a couple of your files previously, to get your plugin to work 100% smoothly with the WP-Ecommerce plugin, and apply these changes each time there is an update, and everything always works ok, each time there is an update.
Just ran your latest update in a test environment, and also made the changes in the assets folder too (this was to the wpmenucart.js file), and the same thing happens again.
If we clear the wp ecommerce widget cart, this doesn’t update in the wp menu cart in the top header. Only updates once you reload the page. Downgraded to previous plugin version, and all ok again.Also, just to confirm that no caches version of any older scripts are being loaded.
Kind Regards,
Andy
- This reply was modified 3 years, 2 months ago by Andrew1977.
- This reply was modified 3 years, 2 months ago by Andrew1977.
Hello Andy,
That’s crucial information indeed. Changes you make towpmenucart.js
will only be loaded in the new version if you have enabledSCRIPT_DEBUG
in yourwp-config.php
file (see: Debugging in WordPress), because without script debug enabled, the minified version will be loaded instead (wpmenucart.min.js
). So if you copy those changes to.min.js
(you could just copy paste the entire contents of the unminified version) it should work like it used to do before the update. I would not recommend enablingSCRIPT_DEBUG
on a live site by the way, as it will increase load time.That said, it’d be great if you could share what changes you made. If they could be beneficial to other WP-Ecommerce site owners, I’d be happy to add them into the release! Or otherwise at least provide you with a way to apply the changes without having to edit the core plugin file after each update ??
Hi Ewout,
Thanks again for the speedy reply.
On all previous versions of WP Menu cart, to get this working 100% smoothly with the WP Ecommerce plugin we have made the following changes:
1) Line 12 in wpmenucart.js, we have added the following line of code to the var buttons:
“.emptycart”,2) In wpmenucart-wpec.php, we have removed all of line 9 of code and removed the following:
add_action(‘wpsc_alternate_cart_html’, array( &$this, ‘wpec_cart_ajax’ ) );3) In functions.php, we have added the following code:
add_action( 'wp_footer', 'wpo_menucart_always_ajax', 999 ); function wpo_menucart_always_ajax() { ?> <script type="text/javascript"> jQuery( function( $ ) { if (typeof wpmenucart_ajax !== "undefined") { function WPMenucart_Load_AJAX() { var data = { security: wpmenucart_ajax.nonce, action: "wpmenucart_ajax", }; xhr = $.ajax({ type: 'POST', url: wpmenucart_ajax.ajaxurl, data: data, success: function( response ) { $('.wpmenucartli').html( response ); } }); } WPMenucart_Load_AJAX(); } });
The above changes get the WP Ecommerce plugin running 100% smoothly with all of the previous versions of the WP Menu cart plugin.
Have tried your suggestions about copying and pasting the entire of the unminified version, and still facing the same issue, with the latest version of the WP Menu Cart plugin.
If you have any other suggestions or ideas on what we could try to get your latest version of this plugin running smoothly with the WP Ecommerce plugin, that would be great.
Hope the above changes that we have made to the plugin help?
Kind Regards,
Andy
- This reply was modified 3 years, 2 months ago by Andrew1977.
- This reply was modified 3 years, 2 months ago by Andrew1977.
Hello Andy,
Could you provide a link to your site so that I can see this live in action? Copying the contents your modified version ofwpmenucart.js
towpmenucart.min.js
and clearing cache should definitely do the trick.Alternatively, I have applied some of the selected changes to our development version of the plugin as well, you can download this here: https://we.tl/t-LZZ7JfjNOO
Here’s what’s changed:
- Removed the deprecated
wpsc_alternate_cart_html
since that wasn’t doing anything anyway (and tripping thehas_action
check in WPEC) - Added the
.emptycart
class to the default list of classes - Added a custom trigger handle
wpmenucart_update_cart_ajax
to allow a simpler version of your code snippet (where you don’t have to rewrite the AJAX call):
add_action( 'wp_footer', function(){ ?> <script type="text/javascript"> jQuery( function( $ ) { $(document).trigger('wpmenucart_update_cart_ajax'); }); </script> <?php }, 999 );
Don’t forget to clear cache when testing this – let me know the results!
Hi Ewout,
Thanks again for such a quick reply.
Very good news!
Have downloaded the development version of the plugin, where you have applied some of the changes, and I can confirm that everything is working 100% perfectly with this development version.
Many thanks for resolving this.
It’s very much appreciated!
Kind Regards,
Andy
Thanks Andy! Can you also confirm that replacing your old
wp_footer
action hook with the one I posted works as expected?Hi Ewout,
I can confirm that replacing our old wp_footer action hook with the one that you posted, works like a charm!
On another subject – is there anyway we could trial out your pro version of this plugin?
Interested in trying out the mini cart in different positions on our mobile version of the site, using the short code that you provide for the pro version; and if it works well, more than happy to then pay and purchase the pro version, if we decide to stay with the pro version.
Just would be nice to be able to trial it out first, if possible?Again, thank you for all your help!
Kind Regards,
Andy
Hi @andrew1977,
We currently don’t offer trial or demo versions of our plugins, but we always provide a refund if you run into an issue with our products that we cannot resolve.
You can find our Refund policy here, specifically the 2nd paragraph: https://wpovernight.com/terms-conditions/
By the way, since we begin talking about a premium plugin, and WordPress doesn’t allow us to provide support or answer pre-sale questions for paid plugins in this forum, please contact us by email if you have more questions about it: [email protected]
I’ll be looking forward to your message!
Thanks @yordansoares
I’ve just sent an e-mail about this.
One other question – when’s the next release of the free version of this plugin due to be released, with the above changes for the WP-Ecommerce plugin to work smoothly?
Kind Regards,
Andy
- This reply was modified 3 years, 1 month ago by Andrew1977.
Hey Andy, just a quick message to let you know that I pushed the official release (2.10.1) with the WP eCommerce updates today!
Hi Ewout,
Many thanks for letting us know.
Just updated to the latest version of this plugin.
For some reason, we’re getting the issue with the mini cart not reflecting the true wp ecommerce cart items again.
Will try and see if we can locate what’s causing this, as when you sent us the development version to try out the other day, this was running smoothly.
Have added the following filter back, and everything is working well again:
add_action( 'wp_footer', 'wpo_menucart_always_ajax', 999 ); function wpo_menucart_always_ajax() { ?> <script type="text/javascript"> jQuery( function( $ ) { if (typeof wpmenucart_ajax !== "undefined") { function WPMenucart_Load_AJAX() { var data = { security: wpmenucart_ajax.nonce, action: "wpmenucart_ajax", }; xhr = $.ajax({ type: 'POST', url: wpmenucart_ajax.ajaxurl, data: data, success: function( response ) { $('.wpmenucartli').html( response ); } }); } WPMenucart_Load_AJAX(); } });
Kind Regards,
Andy
- This reply was modified 3 years, 1 month ago by Andrew1977.
That’s quite strange, the version I sent you before is identical to the release (in the relevant parts of the code)… did you have the
wp_footer
snippet I posted here still active too?
https://www.ads-software.com/support/topic/latest-version-causes-cart-issue/#post-14916388
Could you provide a URL to the store so that we can see if everything is loaded correctly?Hi Ewout,
Thank you for your reply.
The wp_footer snippet that you posted was still active, although we’ve had to remove this for the moment and replace this with our old filter on our live site for the menu cart and wp ecommerce carts to work properly together.
Still trying to investigate why your wp_footer snippet works on our development site, but not on our live site.
Kind Regards,
Andy
Is it possible that on your live site a cached version of the script is used? We do version our scripts and normally WordPress will then append the version to the script URL to make sure that old cache is not loaded, but some security plugins remove the version string and you will then need to manually flush cache (this could even need to be done on for example Cloudflare if your site is using that). If you can provide a URL to the live site I could compare the script that is being served with the one that should be used (or you could compare it yourself of course). The script you will want to look at is
wp-content/plugins/wp-menu-cart/assets/js/wpmenucart.min.js
(assuming you have not enabledSCRIPT_DEBUG
on the live site).
- The topic ‘Latest Version Causes Cart Issue’ is closed to new replies.