• Resolved amzliderit

    (@amzliderit)


    Hello:

    I hope this is the right place to send this message.

    We develop a wordpress web with woocommerce, we install your plugin (free version) to calculate product variations prices and everything was fine until upload all products with variations, and now, the first time a user logs in the web, it can’t load home page. When we put the debug mode on, among all the messages received, was a memory exhausted message. We think the reason is that the first access to home page the plugin calculates the prices, and can’t finish in time (or memory).

    The question is this, if we go to premium version can we trust the performance will be better, enough to load home page the first time a user access?

    Thanks in advance and excuse my skills as redactor in a foreign language.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Andrew Young

    (@meowsupport)

    Hi,

    As far as we understand, this issue happens only after you’ve uploaded some product variations, and the memory exhaustion occurs on one specific page?

    Since your situation is more complex than simply asking, “Would performance be better if…,” let us explain how the plugin and WooCommerce work in a nutshell, so you can debug and find the solution.

    1. The WooCommerce Role Based Pricing plugin doesn’t calculate and display prices or price ranges directly. It uses WooCommerce hooks (e.g., woocommerce_get_price, woocommerce_get_variation_price) to send pricing data to WooCommerce, which then performs the necessary calculations.
    2. In the case of variable products, WooCommerce caches the price calculations to avoid querying the database on every request. It uses WordPress’s transient API to store the price data temporarily. The most resource-intensive operation with variations is calculating the price ranges (_min_variation_price, _max_variation_price).
    3. When WooCommerce needs to display the price of a variable product on the front end (e.g., in a product archive, single product page, or, in your case, the homepage), it checks the cached transients for the minimum and maximum variation prices. If these cached values exist, WooCommerce uses them directly, which speeds up page load times. If the transients are expired or missing (e.g., after product updates or cache clearing), WooCommerce recalculates the prices by querying the database for the variation prices and updates the transient values.
    4. WooCommerce only recalculates variation prices under specific circumstances: when you manually edit the price of a variation in the admin, when the product’s status changes (e.g., from draft to published), when a variation’s sale period starts or ends, or if the transient cache expires (which can be controlled via hooks or cache plugins).
    5. With the WooCommerce Role Based Pricing plugin, when a user role requests the price of a product that hasn’t been calculated yet and price ranges aren’t stored in the transient cache, WooCommerce processes the calculations for each variation (requested by the user). Once the calculations are complete, WooCommerce stores the data in transients. This process shouldn’t repeat unless the transients are cleared (due to the reasons listed in p.4).
    6. By default, an average hosting plan should handle the operation of calculating price ranges and caching transients for a reasonable number of variations without hitting the memory limit. However, this depends on how many variations each variable product has, how many variable products are requested at the same time, and your server’s capacity.

    Therefore, the issue with hitting the memory limit may be caused by several factors:

    • It may happen only during the first pricing calculations for a new user role if too many products are requested at once and your server doesn’t have the capacity to process such queries.
    • It may happen because something is triggering WooCommerce transients to be cleared, which means WooCommerce has to reprocess calculations and regenerate the cache repeatedly. This could happen for reasons listed in p.4 above, or because some plugins request transients to be cleared due to their specific needs.
    • You may have a large number of variable products on the requested page (e.g., hundreds) with many variations in each product, and your server may not have the resources to process the query.

    Recommendations:

    You can use Query Monitor or any other plugin or server tool that helps identify bottlenecks and slow queries. Specifically, look for:

    • Queries taking too long (generally anything above 0.1 seconds),
    • Repeated queries (the same query running multiple times in one request),
    • Queries by Component (to see if a specific plugin, theme, or even WooCommerce is responsible for the slow queries).

    You can also track how long various Woo hooks and actions are taking to see what’s consuming the majority of server resources.

    Additionally, check the number of variable products being requested on one page. It could be that you’re trying to load hundreds of variable products, and some of them don’t retrieve transient data, triggering WooCommerce to initiate calculations instead. In that case, it might be better to limit the number of variable products per page or use something like Lazy Load to retrieve data in smaller portions.

    Thread Starter amzliderit

    (@amzliderit)

    Hello Andrew,

    We going to try every you say in response.

    We are grateful for all the information you gave us about the posible causes of our problem.

    Thank you.

    Plugin Support Andrew Young

    (@meowsupport)

    Hi there,

    Sure thing, happy to help!

    I’m closing this ticket, as it seems there’s nothing more I can assist with at the moment. However, feel free to reply here if you need further clarification, or create a new ticket if you encounter something specific during troubleshooting.

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