The following code isn’t working. And it says “Function id was called incorrectly”
<a href="http://www.amazon.com/gp/product/<?php echo get_post_meta( $product->id , '_amzASIN', true );?>/?tag=solomon09-20" class="button" target="_blank">MORE INFORMATION</a>
Wordpress 6.6.1, PHP 8.2
The code was working with previous versions of woocommerce, wordpress, and on PHP 7.2 etc. Not working with latest versions.
The code extracts amazon ASIN for a particular product from its metadata, and inserts in the above to generate a url.
This is the complete error-
Notice: Function id was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/Newspaper/woocommerce/single-product.php’), do_action(‘tdc_woo_single_product’), WP_Hook->do_action, WP_Hook->apply_filters, {closure}, require_once(‘/plugins/td-composer/legacy/Newspaper/woocommerce/single-product.php’), woocommerce_content, wc_get_template_part, load_template, require(‘/plugins/woocommerce/templates/content-single-product.php’), do_action(‘woocommerce_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action(‘woocommerce_variable_add_to_cart’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_variable_add_to_cart, wc_get_template, include(‘/themes/Newspaper/woocommerce/single-product/add-to-cart/variable.php’), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /home/renopump/public_html/wp-includes/functions.php on line 6085