REST API
PredictCart integrates with WooCommerce's Store API and provides AJAX endpoints for admin operations.
WooCommerce Store API
PredictCart injects additional fields into Store API cart responses, enabling block themes and custom frontends to display adjusted prices.
Additional Response Fields
Each cart item in the Store API response may include:
| Field | Type | Description |
|---|---|---|
predictcart_final_unit | float | The adjusted per-unit price after rules |
predictcart_orig_unit | float | The original per-unit price before adjustments |
predictcart_saving | float | Total savings for this line item |
Top-Level Cart Fields
| Field | Type | Description |
|---|---|---|
predictcart_cart_contents_total | float | Cart total reflecting PredictCart adjustments |
Endpoints Modified
/wc/store/v1/cart/wc/store/v1/cart/items/wc/store/v1/checkout
Admin AJAX Endpoints
All AJAX endpoints require a valid nonce (predictcart_nonce) and manage_woocommerce capability:
| Action | Method | Description |
|---|---|---|
predictcart_get_rules | GET | Fetch all rules |
predictcart_save_rule | POST | Create or update a rule |
predictcart_delete_rule | POST | Delete a rule |
predictcart_duplicate_rule | POST | Duplicate a rule |
predictcart_save_order | POST | Reorder rules (drag & drop) |
predictcart_get_analytics | GET | Fetch analytics data |
predictcart_get_rule_performance | GET | Fetch per-rule performance metrics |
predictcart_get_customer_segments | GET | Fetch customer segment data |
predictcart_get_trends | GET | Fetch discount trend data |
predictcart_get_workflow_activity | GET | Fetch workflow activity data |
predictcart_run_automation | POST | Run an automation manually |
predictcart_schedule_automation | POST | Schedule an automation |
predictcart_unschedule_automation | POST | Unschedule an automation |
predictcart_export_rules | POST | Export rules as JSON |
predictcart_export_automations | POST | Export automations as JSON |
predictcart_export_settings | POST | Export settings as JSON |
predictcart_export_all | POST | Export all data as JSON |
predictcart_import_data | POST | Import data from JSON |
predictcart_save_settings | POST | Save plugin settings |
predictcart_get_notifications | GET | Get notification suggestions |
predictcart_get_products | GET | Search products (Select2) |
predictcart_get_product_categories | GET | Search categories (Select2) |
predictcart_get_customers | GET | Search customers |
predictcart_get_roles | GET | Get user roles |
predictcart_get_countries | GET | Get country list |
predictcart_get_shipping_classes | GET | Get shipping classes |
predictcart_get_shipping_zones | GET | Get shipping zones |
predictcart_get_product_attributes | GET | Get product attributes |
All AJAX endpoints are accessed via admin-ajax.php with the action parameter.