Identify changes in webhook "products/update".

Solved

Identify changes in webhook "products/update".

Drooppy
Shopify Partner
1 0 2

Hello everyone!

 

I need your help with a problem I'm facing while working with Shopify API, specifically with webhooks. My goal is to update my database every time a product changes, considering the associated variants, options and images. However, I have encountered difficulties when i am using the topic "products/update". I am unable to identify exactly what change has been made to the product, is there any way to do this?

 

Thank you in advance for your assistance.

Accepted Solution (1)

flareAI
Shopify Partner
2405 224 549

This is an accepted solution.

Hello @Drooppy,


This is Gina from the flareAI app helping Shopify merchants get $6Million+ in sales from Google Search, on autopilot.


The 'products/update' webhook in Shopify lacks specific details about the changes made to a product. Instead, it merely indicates that a change has occurred without specifying the exact modifications.

 

To identify the specific changes, you have a few alternative approaches to consider.

 

-> Full Comparison

Rather than attempting to identify individual changes, you can perform a comprehensive comparison between the product details retrieved from Shopify and the version stored in your database. If any discrepancies arise, you can update your database with the most up-to-date information.

-> Timestamp Comparison

Maintain a record of the last updated timestamp for each product in your database. Upon receiving the 'products/update' webhook, compare its timestamp with the corresponding product's timestamp in your database. If the webhook's timestamp is more recent, it indicates changes have been made, prompting you to retrieve the updated product details from Shopify.

-> Custom Fields or Metafields

Introduce custom fields or metafields to your Shopify products that can track specific attributes or flags signaling changes. For instance, you can incorporate a 'last_modified' field or a 'changes_made' flag. Whenever you update a product, make sure to appropriately update these fields. Subsequently, when you receive the 'products/update' webhook, you can examine the values of these custom fields or metafields to determine the modifications made.

 

It's crucial to note that Shopify webhooks are primarily designed to notify you of events, rather than offering in-depth details about changes. Therefore, implementing a mechanism to track changes using the aforementioned methods can help you overcome this limitation.


Let me know if you require any further guidance.


Gina

flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing

View solution in original post

Reply 1 (1)

flareAI
Shopify Partner
2405 224 549

This is an accepted solution.

Hello @Drooppy,


This is Gina from the flareAI app helping Shopify merchants get $6Million+ in sales from Google Search, on autopilot.


The 'products/update' webhook in Shopify lacks specific details about the changes made to a product. Instead, it merely indicates that a change has occurred without specifying the exact modifications.

 

To identify the specific changes, you have a few alternative approaches to consider.

 

-> Full Comparison

Rather than attempting to identify individual changes, you can perform a comprehensive comparison between the product details retrieved from Shopify and the version stored in your database. If any discrepancies arise, you can update your database with the most up-to-date information.

-> Timestamp Comparison

Maintain a record of the last updated timestamp for each product in your database. Upon receiving the 'products/update' webhook, compare its timestamp with the corresponding product's timestamp in your database. If the webhook's timestamp is more recent, it indicates changes have been made, prompting you to retrieve the updated product details from Shopify.

-> Custom Fields or Metafields

Introduce custom fields or metafields to your Shopify products that can track specific attributes or flags signaling changes. For instance, you can incorporate a 'last_modified' field or a 'changes_made' flag. Whenever you update a product, make sure to appropriately update these fields. Subsequently, when you receive the 'products/update' webhook, you can examine the values of these custom fields or metafields to determine the modifications made.

 

It's crucial to note that Shopify webhooks are primarily designed to notify you of events, rather than offering in-depth details about changes. Therefore, implementing a mechanism to track changes using the aforementioned methods can help you overcome this limitation.


Let me know if you require any further guidance.


Gina

flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing