T
T
towik00772021-03-17 14:31:07
Facebook
towik0077, 2021-03-17 14:31:07

How to display product id on woocommerce product page?

I started setting up the unloading of woocommerce products in FB through the Facebook pixel. To display tags, an additional OpenGraph plugin was installed.
When checking the micro data tags for a pixel, it gives an error that the product ID is missing. "A required field is missing: id
Products without "id" information can't be uploaded. Please check that this field is included for each product in a separate, labeled column."
Pasted code:

add_action( 'woocommerce_before_single_product_summary', 'cusom_woo_info_1', 10 );
function cusom_woo_info_1() {
global $post;
echo 'Product ID: ' . $post->ID;
}

in functions.php to display id.
And still, when checking this notorious product ID, it does not find it.
Product card template made with Elementor pro.
What can be done so that the FB pixel finds the product ID. Maybe there is another code, or an extension?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question