Archived topic
woocommerce product page critical error, GP + wpml + elementor
7 replies · Started by Gerardo on December 16, 2021
Hello,
I use elementor and also wpml for my website, when I change the default language to a translated one like spanish the page crashes and shows the following error:
Error:
Parse error: syntax error, unexpected '}', expecting end of file in /home/wolows/public_html/wp-content/plugins/gp-premium/elements/class-hooks.php(215) : eval()'d code on line 10
I would really appreciate your help, I don't know what to do.
Thank you for your attention.
Hi there,
in Appearance > Elements - are you using any Hook Elements ?
Hello,
Yes, but there is something strange, even if I put them in draft the error still appears, only when I deactivate the elements the error is solved, the problem is that when I deactivate them the product page is deformed.
Thanks in advance.
What do you have in the Hook Elements ?
Hello,
I have not modified them, they are the default ones that come with generate press. I attach a screenshot

Close Summary Wrap
</div>
<!-- Close gallery wrap -->
Gallery Stack
<div class="woo-summary-wrap"><!-- open wrap -->
<div class="woo-gallery-stack hide-on-mobile">
<?php
global $product;
// Get post product thumbnail
if ( has_post_thumbnail( $product->get_id() ) ) {
$attachment_ids[0] = get_post_thumbnail_id( $product->get_id() );
$attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' );
$attachment_alt = get_post_meta( $attachment_ids[0], '_wp_attachment_image_alt', TRUE);
$attachment_title = get_the_title( $attachment_ids[0] );
?>
<img />" alt="<?php echo $attachment_alt; ?>" title="<?php echo $attachment_title; ?>" width="<?php echo $attachment[1]; ?>" height="<?php echo $attachment[2]; ?>" loading="lazy" />
<?php
}
// Get Product Gallery Images
if ( method_exists( $product, 'get_gallery_image_ids' ) ) {
$product_image_ids = $product->get_gallery_image_ids();
foreach( $product_image_ids as $product_image_id ) {
$image = wp_get_attachment_image_src( $product_image_id, 'full' );
$image_alt = get_post_meta( $product_image_id, '_wp_attachment_image_alt', TRUE);
$image_title = get_the_title( $product_image_id );
echo '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $image_alt . '" />';
}
}
// Closing div found in Close Summary Wrap element
?>
</div>
Woo Breadcrumb Single product
<?php if ( function_exists( 'woocommerce_breadcrumb' ) ) {
woocommerce_breadcrumb();
} ?>
Woo Shop Filter and Breadcrumb
<?php
$icon = '';
if ( function_exists( 'generate_get_svg_icon') ) {
$icon = generate_get_svg_icon( 'menu-bars' );
}
?>
<span class="slideout-toggle woo-filter-toggle hide-on-mobile has-svg-icon"><a href="#"><?php echo $icon; ?> FILTER</a></span>
<span class="hide-on-mobile"><?php woocommerce_breadcrumb(); ?></span>
Woocommerce Shop Category Menu
<?php
$cat_args = array(
'orderby' => 'name',
'order' => 'asc',
'hide_empty' => true,
);
$product_categories = get_terms( 'product_cat', $cat_args );
if ( ! empty( $product_categories ) ) {
echo '<ul class="woo-cat-nav">';
foreach ( $product_categories as $key => $category ) {
printf(
'<li>
<a href="%1$s">
%2$s
</a>
</li>',
get_term_link( $category ),
$category->name
);
}
echo '</ul>';
}
?>
Thanks in advance.
Might have to delete the Hooks totally to see which is a problem.
There are only 3 of them on the Single Product:
Close Summary Wrap
Gallery Stack
Woo Breadcrumb Single product
If you can delete them 3 and then clear any caches to see if that fixes the error.
Hello,
I have sent them to the recycle bin and the problem persists, also, now the gallery cannot be displayed in the untranslated product.
Thanks in advance.
Are all of the Hooks Elements firing for each language? Or are there different Elements for each language?
If the Hook Elements are trashed, there's no way they can create an error. However, I know it's possible to clone posts (or Elements) in WPML for each language, so maybe they're persisting within the other languages and there's an error in one of those?