bigcommerce / bigcommerce-for-wordpress

A headless commerce integration for WordPress, powered by BigCommerce
https://www.bigcommerce.com/wordpress/
GNU General Public License v2.0
109 stars 49 forks source link

New Products get synced into "Draft" #423

Open 2gen opened 1 year ago

2gen commented 1 year ago

Expected behavior

Products that are initially not set as visible during the sync should be updated to visible on the next sync after the "visible on store front" option is checked in big commerce.

Actual behavior

Products get stuck in draft mode and never sync into the publish state.

Steps to reproduce behavior

  1. Add a product to big commerce with no thumbnail and no visibility.
  2. Run wordpress product sync.
  3. Update product on bigcommerce with thumbnail and set to be visible.
  4. Run wordpress product sync again.

Workaround or possible solution

Delete all products from wp entirely via sql and resync them all again.

DELETE FROM wp_posts WHERE post_type='bigcommerce_product'; DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FROM wp_posts); DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts)

JleonardNavitend commented 11 months ago

We are having the same problem. Were you able to find a solution to this? Deleting and resyncing unfortunately didn't solve it.

2gen commented 11 months ago

We are having the same problem. Were you able to find a solution to this? Deleting and resyncing unfortunately didn't solve it.

Yeah I found that deleting the drafts and resyncing those also helped. I made a list of instructions for doing it internally here but I think I can share it with you.

1: put site into maintenance mode https://site-url/wp-admin/admin.php?page=maintenance

2: Delete all products and date with sql script via phpmyadmin. DELETE FROM wp_posts WHERE post_type='bigcommerce_product'; DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FROM wp_posts); DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts)

3: goto https://site-url/wp-admin/edit.php?post_type=bigcommerce_product and select"All Products" in the drop down next to the sync button then click "Sync Products"

4: Wait for it to finish then go to https://site-url/wp-admin/edit.php?post_status=draft&post_type=bigcommerce_product and delete all the drafts.

5: Repeat step 3

6: removed because not relevant to anyone but us 7: removed because not relevant to anyone but us 8: removed because not relevant to anyone but us

9: take site out of maintenance mode https://site-url/wp-admin/admin.php?page=maintenance Reason for step 4 and 5: The bigcommerce plugin has a bug in it where it wrongly marks visible products as draft. Deleting all drafts and syncing again seems to fix it don't know why.