Product ID missing in openschema

#285120
  • Hello,
    I am trying to sync my woocommerce catalog with my Facebook Page using Facebook Pixel.
    When I check the opengraph data, Facebook says that:
    “Products without “id” information can’t be uploaded. Please check that this field is included for each product in a separate, labeled column.”
    How can I solve that?
    Regards,
    Christian

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math for help with WooCommerce open graph meta tags.

    The issue you are facing is handled by a feature in Rank Math PRO. To fix this please install Rank Math PRO.

    Alternatively, you may add the following line to your product page template code:
    <meta property="product:retailer_item_id" content="'. $product->get_sku('view') .'"/>

    I hope that helps. Please let us know if you have questions. We are here to help.

    Hi Nigel,
    Thanks for the quick answer.
    Could you please explain how to add the code in the product template?
    I am using Astra Theme and I haven’t done any modification to the various templates.
    Regards,
    Christian

    Hello,

    Following this tutorial to insert filters on your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Please add the following code:

    
    add_action( 'rank_math/head', function() {
        if ( ! is_product() ) {
            return;
        }
        global $post;
        echo '<meta property="product:retailer_item_id" content="' . $post->ID . '" />';
    }, 99 );
    

    This should print an ID of the product in the metadata and Facebook should be able to see it correctly.

    Don’t hesitate to get in touch if you have any other questions.

    Hi Miguel,
    Thanks for your help.
    Unfortunately it didn’t work.

    I found a solution on another website:

    /**
    * @snippet Add id to OpenGraph for Facebook Pixel Product Catalog sync
    */
    function facebook_open_graph() {
    global $post, $wp_query;
    $postID = $wp_query->post->ID;
    $product = wc_get_product( $postID );
    if ( !is_singular( ‘product’ )) //if it is not a product
    return;
    echo ‘<meta property=”product:retailer_item_id” content=”‘ . $product->get_sku() . ‘”/>’;
    }
    add_action( ‘wp_head’, ‘facebook_open_graph’, 5 );

    Thanks anyway!
    Regards,
    Christian

    Hello,

    Glad that you have already managed to fix this issue on your site.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Product ID missing in openschema’ is closed to new replies.