ForgeWP

Commerce Endpoints and Transports

Separate custom ForgeWP routes from WooCommerce Store API requests and identify current method and route mismatches.

Commerce endpoints and transports

Custom routes live under /wp-json/forgewp/v1. WooCommerce's /wp-json/wc/store/v1 is separate. The generated Auth write guard does not automatically protect the custom commerce routes.

Table · 3 columns
Custom route
Registered methods
Responsibility
/products
GET
Catalog query
/products/{id}/reviews
GET, POST, DELETE
Review list and writes
/cart
GET
Current cart
/cart/add
POST
Add item
/cart/update
POST
Update quantity
/cart/remove
POST
Remove row
/cart/clear
POST
Empty cart
/cart/apply-coupon
POST
Coupon application
/cart/sync
POST
Synchronize item inputs
/cart/shipping-rates
POST
Shipping calculation
/checkout/gateways
GET
Gateway metadata
/checkout/process
POST
Custom order creation, not payment capture
/customer/orders
GET
Current customer's orders
/customer/orders/{id}
GET
Individual order lookup
/customer/downloads
GET
Current customer's downloads
/customer/profile
POST
Profile update
/customer/address
POST
Address update
/wishlist
GET
Wishlist lookup
/wishlist/toggle
POST
Toggle product
/wishlist/sync
POST
Wishlist synchronization

These commerce registrations currently use public permission callbacks; handler-level checks differ. A complete permission, ownership, origin and rate review remains necessary. The route list is not evidence of private-data safety.

Current client mismatches

Standalone cart clear selects GET, but its route accepts POST. Standalone coupon removal calls cart/remove-coupon, which the generator does not register. Provider clearCart clears local UI state rather than invoking a server clear operation. Resolve the implementation gaps rather than weakening server permissions.

Store API helper

fetchStoreApi(endpoint, options?) calls wc/store/v1, sets JSON content type, includes credentials, sends a saved Store API Nonce and optional JWT, refreshes the saved nonce from response headers, and throws on unsuccessful HTTP responses. mapStoreApiToCartState maps the response into the provider's older state shape and converts currency minor units.

Store API Nonce values use wc_store_api; WordPress REST X-WP-Nonce values use wp_rest. They are distinct. Consult the official nonce documentation and Store API contract. The helper alone does not establish first-request nonce bootstrap, session persistence or gateway compatibility.