• Resolved michaelcartersa

    (@michaelcartersa)


    Hi

    I was wondering if anyone else has had this error before and have a workaround:
    Fatal error: Allowed memory size of 536870912 bytes exhausted.

    This originates because of the get_posts call to fetch the products in class-woo-product-stock-alert-action.php,

    $all_products = get_posts(
    array(
    ‘post_type’ => ‘product’,
    ‘post_status’ => ‘publish’,
    ‘numberposts’ => -1
    )
    );

    Cheers,
    Michael

Viewing 1 replies (of 1 total)
  • @michaelcartersa its seems you have very huge data of products on your site, that’s why it’s default allowed memory is exhausted.

    Please follow this step, replace the code at line no 12 with

    $all_products = get_posts(
    array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'numberposts' => -1
    )
    );

    And at line no – 24 and 35 replace $products_each->ID with $products_each, in the class-woo-product-stock-alert-action.php file

    This may reduce the memory executions time.

    Let me know if you need any further assistance.

Viewing 1 replies (of 1 total)
  • The topic ‘Allowed memory exhausted’ is closed to new replies.