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
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:
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 馃憤