Skip to content
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

API Pull - Enable pull and push mechanism to work together #2428

Conversation

jorgemd24
Copy link
Contributor

@jorgemd24 jorgemd24 commented Jun 12, 2024

Changes proposed in this Pull Request:

Part of #2146

For the initial launch, we want to keep both the pull and push mechanisms working together. This PR enables sending the notification (pull mechanism) and the usual job to push the data.

Screenshots:

Detailed test instructions:

  1. Enable the Pull mechanism with the following filter: add_filter( 'woocommerce_gla_notifications_enabled', '__return_true' ); and run this command wp option update gla_wpcom_rest_api_status "approved"

Create Product

  1. Create a product with the visibility "Sync and Show"
  2. Go to WC -> Status -> Scheduled jobs
  3. See that there is a job gla/jobs/update_products/process_item with the product that you created
  4. See that there is a job gla/jobs/notifications/products/process_item with the itemID = the product ID that you created and the topic product.create

Update Product

  1. Update a product
  2. See that there is a job gla/jobs/update_products/process_item with the product that you updated
  3. See that there is a job gla/jobs/notifications/products/process_item with the itemID = the product ID that you updated and the topic product.update

Delete Product

  1. Delete a product
  2. See that there is a job gla/jobs/delete_products/process_item with the product that you deleted.
  3. See that there is a job gla/jobs/notifications/products/process_item with the itemID = the product ID that you deleted and the topic product.delete

Create Coupon

  1. Create a coupon with the visibility "Show Coupon on Google"
  2. See that there is a job gla/jobs/update_coupon/process_item with the coupon that you created
  3. See that there is a job gla/jobs/notifications/coupons/process_item with the itemID = the coupon ID that you created and the topic coupon.create

Update Coupon

  1. Update a coupon
  2. See that there is a job gla/jobs/update_coupon/process_item with the coupon that you updated
  3. See that there is a job gla/jobs/notifications/coupons/process_item with the itemID = the coupon ID that you updated and the topic product.update

Delete Coupon

  1. Delete a product
  2. See that there is a job gla/jobs/delete_coupon/process_item with the coupon that you deleted.
  3. See that there is a job gla/jobs/notifications/coupons/process_item with the itemID = the coupon ID that you deleted and the topic coupon.delete

Update Shipping Settings

  1. Go to WC -> Settings -> Shippings and edit one of the shipping methods
  2. See that there is a job gla/jobs/update_shipping_settings/process_item` scheduled
  3. See that there is a job gla/jobs/notifications/shipping/process_item with the topic shipping.update

Additional details:

Currently, for shipping notifications, we haven't included the topic in the body, only in the header. For consistency, I think it's better to include it in the body as well, so I added it here.: https://github.com/woocommerce/google-listings-and-ads/pull/2428/files#diff-f9aaeb6620028c10c8ce8c3178abf2f6db34168939ba33c4d8bcef410a5125b5R148

Changelog entry

@github-actions github-actions bot added the changelog: update Big changes to something that wasn't broken. label Jun 12, 2024
@jorgemd24 jorgemd24 changed the title Update/allow pull and push mechanism to work together API Pull - Enable pull and push mechanism to work together Jun 12, 2024
@jorgemd24 jorgemd24 self-assigned this Jun 12, 2024
@jorgemd24 jorgemd24 requested a review from a team June 12, 2024 18:32
@jorgemd24 jorgemd24 marked this pull request as ready for review June 12, 2024 18:32
Copy link
Member

@ianlin ianlin left a comment

Choose a reason for hiding this comment

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

Thanks for the change. I tested locally and confirmed all the scenarios are expected. 👍

@jorgemd24 jorgemd24 merged commit 38a2718 into feature/google-api-project Jun 13, 2024
10 checks passed
@jorgemd24 jorgemd24 deleted the update/allow-pull-and-push-mechanism-to-work-together branch June 13, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: update Big changes to something that wasn't broken.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants