Facebook-for-woocommerce: Product m.p.n is not syncing in M.P.N. field on FaceBook Business Manager

Created on 27 Feb 2018  路  8Comments  路  Source: facebookincubator/facebook-for-woocommerce

Hello there,

I have tried to sync my WooCommerce product on facebook business manager product syncing is fine but I want to sync product SKU with M.P.N in facebook business manager.

Also, I have used a filter facebook_for_woocommerce_integration_prepare_product to add a product type as well as MPN field. but product type is synced and MPN field does not sync. Why?

Please see my screenshot at this URL: http://nimb.ws/LeAv3q.

Thanks

question

All 8 comments

Hi @parmarhardip ,

It's difficult to diagnose only with your uploading result. Would you mind give us your implementation (code)? What's your store url?

Thanks.

Hello @mengyingdu

Thank you for the response.

This is my Store URL: https://rhrbrew.com/

Also, I have used to below code in function.php

function facebook_feed_integration_prepare_product( $product_data, $product_id ){
$product_type = '';
$product_terms = wp_get_post_terms( $product_id, 'product_cat', array("fields" => "names") );
if( isset( $product_terms ) && !empty( $product_terms ) ) {
$product_type = join( ',', $product_terms);
}
$product = wc_get_product( $product_id );
$product_data['mpn'] = $product->get_sku();
$product_data['product_type'] = $product_type;
return $product_data;
}
add_filter( 'facebook_for_woocommerce_integration_prepare_product', 'facebook_feed_integration_prepare_product',10,2);

Hi @parmarhardip,

I think it's because get_sku() returns empty string.
You can see we check whether it's empty here
Some online blog using it: https://www.skyverge.com/blog/output-woocommerce-sku/

Thanks.

Hello @mengyingdu

Thank you for the response.

I have checked a filter data and debug SKU function and it returns a string value.

Please see my screenshot at this URL: https://goo.gl/udia4e

Hi @parmarhardip ,

It seems strange if your log shows the function returns value. I have some suggestion for you:

  1. Did you just finish setup and initial sync all products? If so, can you try entered the product editor, that specific product page, click on 'update'?
  1. If you are not in case 1, have you used this filter on previous version before like v1.7.5 ? We have refactor our code structure due to performance improvement after 1.7.5. This filter comes from our pull request, it's possible to have conflict.
    Can you try to uninstall your current version plugin and then delete it, download v1.7.5 from here and then upload, install?
    After this, you can go to one of your product pages and then click on 'update'.

Let me know whether it works.

Thanks.

My another hypothesis is: Due to the developer document of facebook graph API, it seems mpn/brand/gtn are defined in the same column. If you rename it to something else, maybe it work.

Sorry I can't conclude with a absolute answer for now, but i'd like to help you troubleshooting together.

Hi @parmarhardip,

I found the reason now, you should use the key as 'manufacturer_part_number'.
https://developers.facebook.com/docs/marketing-api/reference/product-item/

Hope it works for you! And let me know if you need more help.

Thanks.

Hello @mengyingdu

it's working!

Thank you for the help 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Joshuagier picture Joshuagier  路  6Comments

CTCOC picture CTCOC  路  6Comments

justinrains picture justinrains  路  3Comments

iamgabrielma picture iamgabrielma  路  4Comments

zzbeck picture zzbeck  路  6Comments