Home Forums WoodMart support forum I am getting a critical error when opening a product page

I am getting a critical error when opening a product page

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #614860

    agenciawebinfinite
    Participant

    Hello!

    Yesterday I received this critical error when opening a product page, I had never seen it before.

    I deactivated the theme’s core plugin and reactivated it and it worked.

    Today, the same thing happened again, what could it be?

    Warning: foreach() argument must be of type array|object, string given in /home/lhstore/public_html/wp-content/themes/woodmart/inc/modules/parts-css-files/class-parts-css-files.php on line 288
    
    Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /home/lhstore/public_html/wp-content/themes/woodmart/inc/modules/parts-css-files/class-parts-css-files.php:403 Stack trace: #0 /home/lhstore/public_html/wp-content/themes/woodmart/inc/modules/parts-css-files/class-parts-css-files.php(403): in_array() #1 /home/lhstore/public_html/wp-content/themes/woodmart/inc/enqueue.php(1181): XTS\Modules\Parts_Css_Files->enqueue_inline_style() #2 /home/lhstore/public_html/wp-content/themes/woodmart/inc/modules/header-builder/functions.php(23): woodmart_enqueue_inline_style() #3 /home/lhstore/public_html/wp-content/themes/woodmart/header.php(26): whb_generate_header() #4 /home/lhstore/public_html/wp-includes/template.php(810): require_once('...') #5 /home/lhstore/public_html/wp-includes/template.php(745): load_template() #6 /home/lhstore/public_html/wp-includes/general-template.php(48): locate_template() #7 /home/lhstore/public_html/wp-content/themes/woodmart/woocommerce/single-product.php(14): get_header() #8 /home/lhstore/public_html/wp-includes/template-loader.php(106): include('...') #9 /home/lhstore/public_html/wp-blog-header.php(19): require_once('...') #10 /home/lhstore/public_html/index.php(17): require('...') #11 {main} thrown in /home/lhstore/public_html/wp-content/themes/woodmart/inc/modules/parts-css-files/class-parts-css-files.php on line 403
    Há um erro crítico no seu site.

    Can you help me check what it could be?

    I haven’t updated Woodmart 8.0.0 yet.

    #615093

    agenciawebinfinite
    Participant

    Note:
    Since it is critical and no one has gotten back to me, I updated the theme to 8.0 and for now, it seems to have resolved the issue.

    Let’s see if it is back to normal in 1 or 2 days.

    #615240

    agenciawebinfinite
    Participant

    Hello,

    After updating to Woodmart 8.0, the error mentioned in the previous message disappeared, but this error now started appearing on the product page:

    Warning: foreach() argument must be of type array|object, string given in /home/lhstore/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/frequently-bought-together/class-frontend.php on line 161
    

    https://imgur.com/8rLnsgS

    You can test it at this link:
    https://www.lhstoreshop.com.br/produto/vestido-oasis-de-verao/

    How to solve this?

    #615241

    agenciawebinfinite
    Participant

    And when editing the product, there is this other error:
    https://imgur.com/mMMgHjp

    Warning: foreach() argument must be of type array|object, string given in /home/lhstore/public_html/wp-content/themes/woodmart/inc/integrations/woocommerce/modules/frequently-bought-together/class-table.php on line 126

    #615245

    agenciawebinfinite
    Participant

    For now, I’ve disabled frequently-bought-together so that the error doesn’t show up for clients.

    https://imgur.com/zdc0ooh

    I look forward to your correction.

    #615308

    arbuzas
    Participant

    Have similar issue only critical error was due to Dynamic Pricing. Had to disable it. Any help would be appreciated

    #615432

    Artem Temos
    Keymaster

    Hello,

    Could you please clarify where exactly we can see this error on your website now? How to reproduce it in real-time?
    Also, please clarify if you used any kind of optimizations for your database.

    Kind Regards

    #615705

    agenciawebinfinite
    Participant

    Hello!

    About the first error, it is not possible to reproduce it because I updated the theme to 8.0 and it fixed it.

    For the second error reported here, to reproduce it, you need to reactivate frequently-bought-together in the theme and analyze some products that do not appear (not in all). I sent you the link to one to test.

    I use this plugin to optimize the database keys:
    https://br.wordpress.org/plugins/index-wp-mysql-for-speed/

    #615725

    Artem Temos
    Keymaster

    Hello,

    This plugin broke the key for our theme, and that is why the error occurred https://monosnap.com/file/lJwwKX19S9Syx1Xj6YxGR6zd658YDR

    Kind Regards

    #615765

    agenciawebinfinite
    Participant

    Okay, what’s up?

    I’ve been using this plugin for almost a year on all my sites, and I can’t remove it, especially because on large sites, they are very slow to open orders and products.

    But this is only happening on this site, the others are fine.

    Can you do something to help solve this?

    Or can you INSTRUCT the support of the index wp mysql for speed plugin what to adjust so that this doesn’t happen?

    #615915

    Artem Temos
    Keymaster

    Hello,

    This field should contain an array with the information required for our theme. As an empty array it should look like this []. But it was modified by the plugin an it added an empty string to that array [""]. And that is why you get the error on your website. The plugin shouldn’t change this field by adding extra elements to the array.

    Kind Regards

    #617961

    agenciawebinfinite
    Participant

    Hello!

    How do you know it was this plugin?

    Because I disabled all the keys it optimizes, cleared cache and everything, and the error continues the same way.

    As per your instructions, I edited that field and deleted the double quotes, leaving only [] and it was ok.

    But it doesn’t seem like this plugin’s fault.

    Could you explain to me where you identified that it was this plugin?

    So I can check with the developer.

    Thank you.

    #618337

    Artem Temos
    Keymaster

    Hello,

    We can’t say exactly, but it was assumed that this plugin somehow optimized the database and changed this field. You can disable this plugin and check it for some time to see if the issue reappears.

    Kind Regards

    #618340

    agenciawebinfinite
    Participant

    Hello!

    I don’t agree with your statement, without any proof hehe.

    But it’s okay, I accessed product by product, removed the double quotes, saved and it was ok.

    I reviewed them all, and 90% of the products were ok, I only edited and saved the 10%.

    I will monitor if the new products are ok.

    Thank you.

    #618347

    Artem Temos
    Keymaster

    Hello,

    OK, please let us know if the issue appears again while the plugin is turned off so we can check further.

    Kind Regards

    #622292

    agenciawebinfinite
    Participant

    Hello!

    Just to update, for new products I edit the field and adjust it from [“”] to [] and the product is ok.

    But every new product returns this way.

    I’ll talk to Index MySQL For Speed ​​support to see if they can help.

    #622408

    agenciawebinfinite
    Participant

    Hello!

    Can you check the response from the Index MySQL for Speed ​​developer?

    https://wordpress.org/support/topic/field-being-changed-from-to-and-generating-a-critical-error/#post-18197788

    #622771

    Artem Temos
    Keymaster

    Hello,

    OK, we will just add an extra condition in the code to fix the error. We have added this code on your website so please test how it works now.

    Kind Regards

    #622895

    agenciawebinfinite
    Participant

    Hello!

    Could you please tell me if the code was a snippet or directly in the theme code?

    So that I am aware.

    I will let the client know to test new registrations to see if they will be normalized.

    Thank you.

    #622897

    Artem Temos
    Keymaster

    Hello,

    We added an extra condition in the file inc/integrations/woocommerce/modules/frequently-bought-together/class-frontend.php on the line #157.

    Kind Regards

Viewing 20 posts - 1 through 20 (of 20 total)