Webhooks product update issue
-
I have a question about webhooks.
When order is placed, the stock level of product is calculated and that triggers prodcut.update webhooks. That works perfectly when the product type is Simple Product. However, when the product type is Variable Product I receive this payload{
“code”=>”woocommerce_rest_invalid_product_id”,
“message”=>
“To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.”,
“data”=>{“status”=>404}
}from webhook request.
Webhooks are triggered but the payload is somehow an error message.
This only happens when the stock level is updated by placing orders (Updating the it from product edit page works as expected).
Does anyone have the same issue or know what’s going on with this?Thank you in advance!
-
Hello,
It looks like you are having the same issue as this user:
https://github.com/woocommerce/woocommerce/issues/15319Please read mikejolley’s reply on that page to see if that fixes the issue for you too.
Hi @maykato, thank you for your response.
Yes it looks like that what the error message indicates. However my issue is that the stock level update process happens internally in WooCommerce when orders are placed (when purchase happens) and that is not under my control.
What I did was to create a webhook with topic product.update and purchased a product and got that webhook payload{
“code”=>”woocommerce_rest_invalid_product_id”,
“message”=>
“To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.”,
“data”=>{“status”=>404}
}Could you please assist me with this issue?
Regards,
MizukiHi @mizuki0208,
Are you using a third-party service to manage the product stock level?
Could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
Thanks.
Hi @rainfallnixfig thank you for your quick response!
Not that I’m aware of.
### WordPress Environment ### WordPress address (URL): https://mrktplcwoocomm.wpengine.com Site address (URL): https://mrktplcwoocomm.wpengine.com WC Version: 5.8.0 REST API Version: ? 5.8.0 WC Blocks Version: ? 5.9.1 Action Scheduler Version: ? 3.3.0 WC Admin Version: ? 2.7.2 Log Directory Writable: ? WP Version: ? 5.8.3 - There is a newer version of WordPress available (5.9) WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: – WP Cron: ? Language: en_US External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 7.4.26 PHP Post Max Size: 100 MB PHP Time Limit: 3600 PHP Max Input Vars: 10000 cURL Version: 7.58.0 OpenSSL/1.1.1 SUHOSIN Installed: – MySQL Version: 5.7.36-39-log Max Upload Size: 50 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 5.6.0 WC Database Prefix: wp_ Total Database Size: 8.61MB Database Data Size: 6.15MB Database Index Size: 2.46MB wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.28MB + Index: 0.28MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.08MB + Index: 0.13MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 3.05MB + Index: 0.09MB + Engine InnoDB wp_postmeta: Data: 1.52MB + Index: 0.78MB + Engine InnoDB wp_posts: Data: 0.11MB + Index: 0.06MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.06MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woo_shippment_provider: Data: 0.06MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### attachment: 21 page: 8 post: 2 product: 17 product_variation: 19 revision: 2 shop_order: 285 shop_order_refund: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (5) ### Jetpack: by Automattic – 10.3 Product GTIN (EAN, UPC, ISBN) for WooCommerce: by Emanuela Castorina – 1.1.1 WooCommerce Stripe Gateway: by WooCommerce – 5.7.0 WooCommerce Shipping & Tax: by WooCommerce – 1.25.21 WooCommerce: by Automattic – 5.8.0 (update to version 6.1.1 is available) ### Inactive Plugins (2) ### Advanced Shipment Tracking for WooCommerce: by zorem – 3.3 Akismet Anti-Spam: by Automattic – 4.2.1 ### Dropin Plugins (1) ### advanced-cache.php: advanced-cache.php ### Must Use Plugins (6) ### Force Strong Passwords - WPE Edition: by Jason Cosper – 1.8.0 WPE ElasticPress Autosuggest Logger: by WP Engine – 1.0.0 WP Engine Cache Plugin: by WP Engine – 1.0.5 WP Engine Seamless Login Plugin: by WP Engine – 1.5.5 WP Engine Security Auditor: by wpengine – 1.0.10 WP Engine System: by WP Engine – 5.0.1 ### Settings ### API Enabled: ? Force SSL: ? Currency: AUD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: ? ### WC Pages ### Shop base: #5 - /shop/ Cart: #6 - /cart/ Checkout: #7 - /checkout/ My account: #8 - /my-account/ Terms and conditions: ? Page not set ### Theme ### Name: Storefront Version: 3.9.1 Author URL: https://woocommerce.com/ Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ? ### Templates ### Overrides: – ### Action Scheduler ### Complete: 185 Oldest: 2022-01-12 05:43:28 +0000 Newest: 2022-02-01 04:14:45 +0000 Failed: 1 Oldest: – Newest: – ### Status report information ### Generated at: 2022-02-01 15:15:12 +11:00
looking forward to hearing from you.
Mizuki
I have noticed that when I use WP REST API Integrations v2 or above for webhook API Version it works as expected. Do you know why v1 doesn’t support it?
Regards,
MizukiHi @mizuki0208
Thanks for sharing the System Status Report.
Before we check for other possibilities, can you please update WordPress and WooCommerce to their respective latest versions? Your system report is showing outdated versions of both.
Once that is done, please check if the issue persists and let us know.
Thanks
Great! Thank you for letting us know.
mrktplcwoocomm.wpengine.com looks like a staging/development site, if it is not, we recommend that you do a full backup and update in a staging environment without modifying your live site as updates may generate errors and impact your customers.
WP Engine seems to include a staging site feature but you can also create a staging site with the WP Staging plugin.
Cheers.
We haven’t heard back from you in a while, so I’m marking this thread as closed for now – we’ll be here if and/or when you are ready to continue.
- The topic ‘Webhooks product update issue’ is closed to new replies.