facebook-for-woocommerce
facebook-for-woocommerce copied to clipboard
Some product variations missing variant IDs and they don't show on Facebook Shop
π Isolate the bug
- [x ] I have confirmed this occurs in the most recent version of WordPress, WooCommerce, and Facebook for WooCommerce.
- [x ] I have confirmed this occurs when only WooCommerce and Facebook for WooCommerce are active and when using a default WordPress or WooCommerce theme.
βοΈ Describe the bug
There are some specific variable products that have some variations missing variant IDs despite I tried to remove them from Facebook and re-add it again.
It's the log I've got

The other products on my site are working properly, only some specific items I can't configure to add to Facebook Shop.
I use WP All Import to trigger create / update products, but it's strange that the others are fine, just some specific items have this issue.
πΆββοΈ Steps to reproduce
- Create/add product
- Product has an issue syncing with Facebook.
- I tried the button Delete this product from Facebook, then refresh and add it again but it's the same result.

βοΈ Expected behavior
All products should be synched with Facebook Shop.
Hi @daomapsieucap,
Could you provide a screenshot for one of the variations not synced?
I see something about "No options" for one of pa_merk on your debug log screenshot. I think this could be related to variation configuration.
Thanks
@rawdreeg Below are the attributes setup for this variable product, I set the Merk attribute not to be used in variation. #1067738 is the variation that has this issue.

Thanks.
Thanks for providing the screenshot, @daomapsieucap. I cannot immediately tell what's wrong by looking at the screenshots.
However, I attempted to reproduce the issue by creating an attribute and leaving the "Used for variations" checkbox empty.
I could reproduce the errors from your log screen capture:

and also, the variants appeared to empty initially:

However, refreshing the editing page showed that the variants were all synced:

...
From your previous screenshot, I see you used an old version of the publish. Can you confirm you're using the latest version of the plugin and you're still experiencing this?

@rawdreeg Yes, I confirm that I've updated the latest version (v2.6.18) of Facebook for Woocommerce plugin and try to re-save this product but it doesn't work.

Thanks, @daomapsieucap,
I tried recreating the issue. I have set the option to hide out-of-stock items from the catalog to true and repeated the test. And initially, the variant IDs are empty, like in your screenshot. but I gave it 5 to 10 minutes, and I refreshed, I could see the FB ID for the variations:

I also checked in my FB catalog, and the variant is synced:

I think what's happening initially, the FB IDs are not cached in the DB:
https://github.com/woocommerce/facebook-for-woocommerce/blob/fc71daae852e090543c2e734c4c7dd14a695c91a/facebook-commerce.php#L606-L623
then we try to fetch them from FB again:
https://github.com/woocommerce/facebook-for-woocommerce/blob/fc71daae852e090543c2e734c4c7dd14a695c91a/facebook-commerce.php#L625-L640
FB could be too slow returning the IDs at times. That would be the reason for the delay.
Although, I think we can optimize this process. I think the variation sync should work as intended unless you can't find the variants in your FB catalog, then we'd have to see the logs.
Thanks for more information about the Facebook ID @rawdreeg but unfortunately I can't find this product on Facebook shop and the variant IDs still empty until now.

There are some specific products I can't force a sync to Facebook, like the product I gave example, is there anything else I can debug to see what happened or how to add them to Facebook shop?
Thanks, @daomapsieucap,
Can I suggest editing the affected product(s), locating the Facebook Product Sync sidebar box, and using it to Reset Facebook metadata or Delete product(s) on Facebook so it can resync with the correct data?
Let me know if that works.
Actually, I tried both Reset and Delete product(s) button on the sidebar but it still didn't work @rawdreeg. Is there any code I can add to run in functions.php to sync the product directly to Facebook without adding it to the plugin queue? I just want to test and see the debug log if there is anything wrong.
And I have one more question, how can I find the specific schedule task of Facebook for Woocommerce to trigger the queue? Just because I found many rows with the prefix wc_facebook_background_product_sync_job in the database but most of them have the status queued which means it didn't run correctly.
I think it's because I have too many products and these products are still in the queue when I tried to delete/reset Facebook data, so that's why it's not working when I use these buttons.
Is there anyway I can test the request to push products to Facebook directly? (in case there is anything wrong)
Is there anyway I can test the request to push products to Facebook directly? (in case there is anything wrong)
I am not entirely sure of the request. But you can force a product sync by going to Marketing > Facebook for WooCommerce > Product sync.

Not sure if this helps.
I used this button and wait until it was finished but the remaining products don't seem correct. It's showing 32 items left but as I checked in the database, there are many items with queued status as I mentioned in my previous comment:
And I have one more question, how can I find the specific schedule task of Facebook for Woocommerce to trigger the queue? Just because I found many rows with the prefix
wc_facebook_background_product_sync_jobin the database but most of them have the status queued which means it didn't run correctly.
How can I reset all the Facebook for Woocommerce database and make it progress from the beginning?
@daomapsieucap,
There's this snippet in the plugin in the documentation that can help with this.
Another way to delete or bulk-reset the catalog is to use a feed file (data source) with a replace schedule: facebook.com/business/help/2284463181837648
Hi @daomapsieucap,
Have you been able to resolve this issue?
Hi @rawdreeg,
Sorry, I tried multiple ways to debug and fix the issue but my client can't wait for such a long time, so I decided to use another plugin instead. Thanks for the support.
P/S: When cleaning up the database to use another plugin, I found that there are many wc_facebook_background_product_sync_job rows queued in the database but they never finish. I'm not sure what's wrong here.
Thanks for the feedback, @daomapsieucap.
P/S: When cleaning up the database to use another plugin, I found that there are many wc_facebook_background_product_sync_job rows queued in the database, but they never finish. I'm not sure what's wrong here.
Yes, this is supposed to run with the wp_cron. Worth checking if this is running correctly on your site.
We haven't had any other reports of the issue. I would assume this may be particular to your site and need to be investigated separately. You can contact WooCommerce support if you decide to look further into this. I will close this issue for now.