Help with WooCommerce API Calls, Order Metadata, Stock Updates & Settings
-
Dear WooCommerce Support Team,
I am developing a custom WooCommerce integration plugin that connects my store with an external API for automatic product ordering and license key management. To ensure a seamless and correct implementation, I need your assistance in clarifying some key aspects of WooCommerce functionality.
1?? API Calls & Order Processing
I want my plugin to trigger an API request when an order status changes to Completed.
- Is
woocommerce_order_status_completed
the best hook to use, or do you recommend an alternative? - Are there any known limitations or best practices for making API calls when an order is marked as completed?
2?? Custom Order Metadata for License Codes
The API returns a license code when an order is completed, and I need to store it in WooCommerce orders.
- What is the best method to store and retrieve custom metadata inside WooCommerce orders?
- Is there a recommended way to make these license codes accessible in the WooCommerce order details for both admins and customers?
3?? WooCommerce Stock Management
The API also provides real-time stock levels for products. I need to update WooCommerce stock based on these API responses.
- If I update stock levels using
update_post_meta( $product_id, '_stock', $new_stock )
, will it work correctly with WooCommerce’s inventory management? - Is there a preferred WooCommerce function for dynamically updating product stock to ensure compatibility with WooCommerce’s stock control?
4?? WooCommerce Settings Integration
I am adding a custom settings tab inside
WooCommerce > Settings
for configuring API credentials and plugin options.- What is the correct method or recommended WooCommerce hook to add a new settings page inside WooCommerce settings?
I would greatly appreciate your guidance on these points to ensure seamless integration.
Looking forward to your response.
Best regards,
Zaid
- Is
- You must be logged in to reply to this topic.