Skip to main content

Update Product

PUT/products/
Updates a product you own. Accepts the same full field set as Create Product; all fields are optional except slug. Only the fields you send are changed — except where a field is a managed collection (see Sync & replace semantics).

Authentication

Headers

HeaderValueRequired
AuthorizationBearer YOUR_API_TOKENYes
Acceptapplication/jsonRecommended
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
idintegerYesProduct id (must belong to your store)

Body Parameters

All fields from Create Product are accepted and optional except slug:
  • Core: name, slug* (must remain unique in your store), type, description, marketing_title, activation_info, status, show_reviews, is_noticeable
  • Pricing/inventory: price, cost_price, discount_price, discount_expiry, stock, min_qty, max_purchase_count
  • Media: image.file.response.id (omit to keep current), product_files[], extra_images[]
  • Relations: categories[], benefits[], fields[]
  • Per type: codes[] (code), subscriptionVariants[] (+ license_config / subscription config), course (sections/modules)
  • Display/SEO: metadata.display.*, seo.*
Refer to the create reference for the exact shape of each object.

Sync & replace semantics

FieldBehavior on update
codesReplaces the live (unsold) code set. To add, send the existing codes plus new ones. Sold codes are preserved.
subscriptionVariantsSynced by id: include id to update a variant, omit id to create, omit a variant entirely to delete it. A subscription/license must keep at least one variant (an empty array is rejected).
subscriptionVariants[].featuresSynced by id within each variant.
course.sections / modulesSynced by id; omitted sections/modules are deleted.
product_files / extra_imagesSynced; ids omitted from the list are detached/removed from the product.
imageOmit to keep the current image; provide a new media id to replace it.
benefits / categoriesReplace the full set you send.

Example Requests

curl -X PUT "https://merchant-api.rmz.gg/shawarma/products/103" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Key (v2)",
    "slug": "premium-key",
    "type": "code",
    "price": 59.99,
    "codes": [ { "code": "KEY-AAA-111" }, { "code": "KEY-CCC-333" } ]
  }'

Success Response

200 OK
{
  "message": "تم تحديث المنتج بنجاح",
  "data": {
    "id": 103,
    "name": "Premium Key (v2)",
    "slug": "premium-key",
    "type": "code",
    "price": 59.99,
    "codes": [ { "id": 5001, "code": "KEY-AAA-111" }, { "id": 5003, "code": "KEY-CCC-333" } ]
  },
  "api": "rmz.shawarma",
  "timestamp": 1699999999
}

Error Responses

CodeDescription
401Unauthorized — invalid or missing token
403Plan does not include the API feature, or license type requires a plan with license integration
404Product not found in your store, or a referenced media id is not yours
422Validation error (e.g. duplicate slug, empty subscriptionVariants for a subscription/license). The data object contains field errors.