Hey @riakhmerov,
I have investigated your issue and I saw this entire PHP notice:
[17-Oct-2019 19:46:43 UTC] PHP Notice: Undefined variable: product_id in /home2/calivolv/public_html/wp-content/themes/x-child/functions.php on line 142
[17-Oct-2019 19:46:43 UTC] PHP Notice: Undefined variable: product_id in /home2/calivolv/public_html/wp-content/themes/x-child/functions.php on line 142
[17-Oct-2019 19:46:43 UTC] PHP Notice: Undefined variable: product_id in /home2/calivolv/public_html/wp-content/themes/x-child/functions.php on line 142
[17-Oct-2019 19:46:43 UTC] PHP Notice: Undefined variable: product_id in /home2/calivolv/public_html/wp-content/themes/x-child/functions.php on line 142
[17-Oct-2019 19:47:18 UTC] PHP Notice: id was called <strong>incorrectly</strong>. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/x/woocommerce.php'), x_get_view, X_View_Router::render, include('/themes/x/framework/views/integrity/woocommerce.php'), woocommerce_content, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-single-product.php'), do_action('woocommerce_after_single_product_summary'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_output_product_data_tabs, wc_get_template, include('/themes/x/woocommerce/single-product/tabs/tabs.php'), comments_template, require('/themes/x/woocommerce/single-product-reviews.php'), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.0.) in /home2/calivolv/public_html/wp-includes/functions.php on line 4778
It came from your custom PHP code;
add_action( 'woocommerce_before_shop_loop_item_title', 'addHoverImageToProducts', 10 );
function addHoverImageToProducts() {
global $product;
$attachment_ids = $product->get_gallery_image_ids();
$count = 0;
foreach( $attachment_ids as $attachment_id ) {
$count++;
//make sure you're on the Shop Page and that you only get the first image
if(is_shop() && $count <= 1){
?>
<div class="secondary-container"><a href="<?php echo get_permalink($product_id); ?>"><div class="product-secondary-image" style="background-image:url('<?php echo wp_get_attachment_image_src( $attachment_id, 'full' )[0]; ?>'); background-repeat:no-repeat;"></div></a></div>
<?php
}
}
}
The <?php echo get_permalink($product_id); ?>
should be replaced with <?php echo get_permalink(); ?>
. Or may explicitly need to define the product ID to get the permalink. Are you the one coding this function? You may need to contact the creator of this function for the resolution of the PHP notice.
Please keep in mind that custom coding is beyond the scope of our support. Please reach out to the source of the code of whoever coded this. Or you just simply ignore since this is just a PHP notice. It would affect any feature or functionality to your site.
Hope this helps.