Skip to content

Block Shipping, Products and Coupons when Sync Push is disabled #2810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from

Conversation

puntope
Copy link
Contributor

@puntope puntope commented Mar 4, 2025

Changes proposed in this Pull Request:

Block Merchant Center Sync in case the Sync is disabled for the datatype

Detailed test instructions:

  1. Checkout PR and have a completed onboarding. All the Sync Datatype for PUSH should be enabled
  2. Create a product. Go to WoOCommere Scheduled actions and see gla/jobs/update_products/process_item. Run it
  3. Update the product. Go to WoOCommere Scheduled actions and see gla/jobs/update_products/process_item. Run it
  4. Create a coupon and select "Show in Google" . Go to WoOCommere Scheduled actions and see gla/jobs/update_coupon/process_item. Run it
  5. Create a coupon and select "Show in Google". Go to WoOCommere Scheduled actions and see gla/jobs/update_coupon/process_item. Run it
  6. Go to Google - Shipping tab and select "Automatically sync my store’s shipping settings to Google."
  7. Go to WooCommerce - Settings - Shipping and create a Shipping Zone
  8. Go to WooCommerce - Status - Scheduled Actions and see gla/jobs/update_shipping_settings/process_item
  9. Deactivate Push Sync for Products, Coupons and Shipping
  10. Repeat step 3. No Job should be scheduled
  11. Try to sync a product manually using the Connection Test Page. It should fail. "Error submitting product to Google: Pushing products will not run if the PUSH Sync functionality has been disabled."
  12. Repeat steps 5. No Job should be scheduled
  13. Repeat step 8. No Job should be scheduled

Additional details:

PT: pcTzPl-2yG-p2

Changelog entry

@github-actions github-actions bot added type: enhancement The issue is a request for an enhancement. changelog: add A new feature, function, or functionality was added. labels Mar 4, 2025
Base automatically changed from add/check-pull to feature/api-pull-sync-endpoint March 10, 2025 06:46
@puntope puntope self-assigned this Mar 16, 2025
@puntope puntope requested a review from a team March 16, 2025 16:32
@puntope puntope marked this pull request as ready for review March 16, 2025 22:00
Copy link

codecov bot commented Mar 16, 2025

Codecov Report

Attention: Patch coverage is 42.10526% with 33 lines in your changes missing coverage. Please review.

Project coverage is 67.2%. Comparing base (c5c67ec) to head (8bced8e).
Report is 401 commits behind head on develop.

Files with missing lines Patch % Lines
src/Product/ProductSyncer.php 7.1% 13 Missing ⚠️
src/ConnectionTest.php 0.0% 6 Missing ⚠️
src/Coupon/CouponSyncer.php 64.3% 5 Missing ⚠️
src/Coupon/SyncerHooks.php 50.0% 3 Missing ⚠️
src/Product/SyncerHooks.php 50.0% 3 Missing ⚠️
src/API/Google/Settings.php 0.0% 2 Missing ⚠️
src/Jobs/AbstractCouponSyncerJob.php 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             develop   #2810     +/-   ##
===========================================
- Coverage       67.3%   67.2%   -0.1%     
- Complexity      4709    4721     +12     
===========================================
  Files            481     481             
  Lines          19725   19770     +45     
===========================================
+ Hits           13267   13281     +14     
- Misses          6458    6489     +31     
Flag Coverage Δ
php-unit-tests 67.2% <42.1%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Jobs/AbstractProductSyncerBatchedJob.php 100.0% <100.0%> (ø)
src/Jobs/AbstractProductSyncerJob.php 100.0% <100.0%> (ø)
src/Jobs/UpdateShippingSettings.php 100.0% <100.0%> (ø)
src/MerchantCenter/MerchantCenterService.php 91.5% <100.0%> (-1.3%) ⬇️
src/Shipping/SyncerHooks.php 100.0% <100.0%> (ø)
src/Jobs/AbstractCouponSyncerJob.php 0.0% <0.0%> (ø)
src/API/Google/Settings.php 6.2% <0.0%> (-<0.1%) ⬇️
src/Coupon/SyncerHooks.php 77.8% <50.0%> (-0.9%) ⬇️
src/Product/SyncerHooks.php 89.0% <50.0%> (-1.7%) ⬇️
src/Coupon/CouponSyncer.php 69.9% <64.3%> (-2.6%) ⬇️
... and 2 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mikkamp mikkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @puntope for working on these changes.

As explained in the comments, I think we should follow some of the simple logic as is done for Shipping. As it is right now a product/coupon status will still be changed to pending sync even if push is disabled, we should not allow any changes if it's disabled.

Base automatically changed from feature/api-pull-sync-endpoint to develop May 20, 2025 12:23
budzanowski and others added 2 commits May 29, 2025 16:24
Update SyncerHooks tests to mock the is_enabled_for_datatype method
that was added to prevent sync jobs when PUSH is disabled. The tests
now properly expect sync operations to be scheduled or not based on
the merchant center status.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@budzanowski
Copy link
Collaborator

This PR will be delivered as part of the combined effort in #2981, which includes both the sync push controls and WC REST API settings integration. Closing this individual PR in favor of the combined approach.

@eason9487 eason9487 deleted the add/check-push branch June 24, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: add A new feature, function, or functionality was added. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants