Home › Toolset Professional Support › [Resolved] WooCommerce Views – possible bug?
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Content Templates, Views plugin
Related documentation:
This topic contains 16 replies, has 3 voices.
Last updated by peg 7 years, 5 months ago.
Assisted by: Shane.
Hi there,
I am having an issue with the Woocommerce Views plugin when used together with the Aelia Currency Switcher plugin and I found that the Woocommerce Views plugin might be the cause.
When both plugins are active and the Woocommerce Views template is chosen for single product pages I am getting constanly php error notices in my error log filling it up quickly.
Those messages only show up if I open a single product with variations. This does not happen, however, if I open a subscription product with variations.
The error notices are:
PHP Notice: min_variation_sale_price was called incorrectly. Product properties should not be accessed directly.
same for: max_variation_sale_price, min_variation_regular_price, max_variation_regular_price
I can provide a duplicator copy if you set my next reply to private.
Thanks,
Peg
Hi Peg,
Thank you for contacting our support forums.
Notices in PHP are usually thrown when a standard isn't followed, however the standard may not be the best way of implementing certain items .
Notices can also occur because of many plugins implementing their own way of doing something .
They are generally the least important and does not indicate a bug or cause functionality problems.
Thanks,
Shane
Hey Shane,
That's what I hear all the time ... However, I take those notices seriously as they tell me if something in my own code has to be adjusted.
After the recent big Woocommerce Update every plugin author took care of the changes and I myself had to update my code as well.
I have been testing my entire setup for a couple of days now and Woocommerce Views is the only plugin left that is causing my error log to grow insanely once anyone opens a variation product.
I have tested everything and found that one shortcode is responsible for those notices:
[wpv-woo-buy-options add_to_cart_text='']
As soon as this shortcode is added to the template it is causing this behavior.
Now, how shall we proceed?
Hi Peg,
Not sure if you updated your Woocommerce Views but we recently made a new release 🙂
So if you have not yet performed an update, could you please try this and let me know.
Thanks,
Shane
Hi Shane,
I've just updated to yesterday's version but unfortunately this doesn't solve the issue.
I'd suggest you let your devs take a look at the site.
As I said I can provide a duplicator package but I would prefer to submit the link in private mode.
Hi Peg,
Could you try the following debugging steps to ensure to see if the we can isolate where the problem is coming from.
->In Toolset -> WooCommerce Views (settings at backend), select the following settings:
*WooCommerce Plugin Default Template ( for 'Product Template file' )
*WooCommerce Plugin Default Archive Template ( for 'WooCommerce Plugin Default Archive Template' )
->Scroll down and save all settings.
->Go to plugins and deactivate 'all' Toolset plugins leaving only WooCommerce core and all third party plugins activated (e.g. 'Aelia Currency Switcher plugin' )
->Once all Toolset plugins are deactivated, the site will reset to use default WooCommerce core templates for products and archives.
->Clear the browser cache
->Then go to the page where the PHP error notices are logged.
Please let me know if the error still remains.
THanks,
Shane
Hi Shane,
Following your procedure (and I did it before to isolate the problem) I can say: no error messages appear.
I haven't mentioned that the duplicator package I can provide is actually not my site but a fresh WP install with only Woocommerce, Aelia Currency Switcher and the Toolset plugins installed on the Twentyfifteen Theme.
The error messages only show up when the Toolset plugins are installed and if I use a Woocommerce Views template with above mentioned shortcode. And only if I go to a single product page that is a simple product with variations.
I think this points us to a direction.
Hi Peg,
No worries,
I'll enable the private fields for your next response so that you can provide me with the duplicator package.
Thanks,
Shane
Hi Peg,
Was this site running on local server?
What version of php is running on that server.
Thanks,
Shane
Hi Shane,
yes, I had this test site set up on XAMPP for Windows 7.0.13.
My life site which shows the same messages runs on php 7.0.
Thanks,
Peg
Hi Peg,
I've escalated this issue for you for further debugging.
Thanks,
Shane
I think I have succesfully replicated this even on a clean install.
It happens in this exact pattern:
1. Install the Toolset + WooCommerce Views + WooCommerce + Aelia Currency Switcher + Aelia Foundation Classes
hidden link
hidden link
2. Set up WooCommerce Views to use Content Templates
3. Set up the Aelia Currency Switcher + Aelia Foundation Classes (you just need to set one currency)
4. Set up a variable product as this:
one or more attribute
one or more variations
each variation or at least one must have a sales and a regular price
5. In the applied Content Template add [wpv-woo-buy-options add_to_cart_text='']
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-buy-options
6. Enable WP Debug and visit the Product single variable
It throws the given notice.
Now, for the current moment, please do disable the WordPress error display or logging, as this is just a notice and so far does not break the functionality.
This will then show the Select Field properly again.
I will now start to debug this, and with some luck, I can pass this to our developers by the end of day.
Shane will stay in touch with you about the progress.
Hi Beda,
Thanks for looking into this.
Little correction, though: for the variable product the messages also show up if there is no sale price but only the regular price set.
Interesting also, that no error messages are shown if I open a variable subscription product. It only happens on simple products.
Thanks a lot.
Peg
Hi Peg,
Thank you for the continued patience.
We have some updates on this one from our development team. The response goes as follows.
These properties are only set by Aelia Currency Switcher plugin.
How the properties are set
>These custom properties are set by Aelia Currency Switcher plugin by hooking to woocommerce_product_is_on_sale filter.
From what I observed, this is not the most compatible thing to do since other plugins can easily override or reset the global $product by simply calling WooCommerce wc_setup_product_data(). Or third party theme templates can override and remove woocommerce_before_single_product_summary hook in the templates (this is the WC hook which calls the the filter that sets the custom properties.)
For example here WC Views uses standard hook: do_action('woocommerce_variable_add_to_cart') to display variable add to cart button. But since Aelia Currency Switcher plugin hooks to WC and setting custom properties directly to WC $product object. Its a fragile implementation as I've mentioned and when it looks for min_variation_sale_price (which is not there - since this is not default WC properties - can easily be overridden), it throws the PHP notices because WC assumes its their own properies( which is not).
What I suggest to the plugin author is to set properties 'always after' WooCommerce core sets their own properties too when the call to 'wc_setup_product_data()' is made. This will ensure that any custom call to set properties, their custom properties will always included.
Or, if they find this difficult since after WC 3.0 the WC team is very restrictive to third party-plugins overriding their own properties. The plugin author can store their own custom properties on its own plugin object. This is much safer thing to do. And there is no way other third party plugins can override this itself.
So the conclusion here is that the notices are not originated from our Woocommerce Views plugin.
Thanks,
Shane
Hi Shane,
Thank you for the detailed explanation and your developers for taking the time to look at it. I'll submit your findings to the Aelia team.
I will keep this thread open for a bit. Just in case there are further questions.
Thanks a lot.
Best,
Peg