facebook-for-woocommerce icon indicating copy to clipboard operation
facebook-for-woocommerce copied to clipboard

Some product variations missing variant IDs and they don't show on Facebook Shop

Open daomapsieucap opened this issue 3 years ago β€’ 12 comments

πŸ”Ž 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

Screenshot-1654769372

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

  1. Create/add product
  2. Product has an issue syncing with Facebook.
  3. I tried the button Delete this product from Facebook, then refresh and add it again but it's the same result.

Screenshot-1654769646

βœ”οΈ Expected behavior

All products should be synched with Facebook Shop.

daomapsieucap avatar Jun 09 '22 10:06 daomapsieucap

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 avatar Jul 19 '22 10:07 rawdreeg

@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.

Screenshot-1658301883 Screenshot-1658301717

Thanks.

daomapsieucap avatar Jul 20 '22 07:07 daomapsieucap

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:

Screenshot 2022-07-20 at 20 59 07

and also, the variants appeared to empty initially:

Screenshot 2022-07-20 at 20 56 11

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

Screenshot 2022-07-20 at 20 56 42

...

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 avatar Jul 20 '22 19:07 rawdreeg

Screenshot-1658485995

@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.

Screenshot-1658486115

daomapsieucap avatar Jul 22 '22 10:07 daomapsieucap

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:

Screenshot 2022-07-22 at 16 08 47

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

Screenshot 2022-07-22 at 16 13 36


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.

rawdreeg avatar Jul 22 '22 14:07 rawdreeg

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. Screenshot-1660126382

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?

daomapsieucap avatar Aug 10 '22 10:08 daomapsieucap

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.

rawdreeg avatar Aug 18 '22 15:08 rawdreeg

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.

daomapsieucap avatar Aug 25 '22 11:08 daomapsieucap

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)

daomapsieucap avatar Aug 25 '22 11:08 daomapsieucap

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.

Screenshot 2022-08-31 at 11 06 33

Not sure if this helps.

rawdreeg avatar Aug 31 '22 09:08 rawdreeg

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_job in 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 avatar Sep 06 '22 08:09 daomapsieucap

@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

rawdreeg avatar Sep 15 '22 17:09 rawdreeg

Hi @daomapsieucap,

Have you been able to resolve this issue?

rawdreeg avatar Oct 19 '22 11:10 rawdreeg

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.

daomapsieucap avatar Oct 27 '22 03:10 daomapsieucap

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.

rawdreeg avatar Oct 27 '22 11:10 rawdreeg