Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/aerele/medusa_integration/llms.txt

Use this file to discover all available pages before exploring further.

The ERPNext Medusa Integration installs a set of custom doctypes that store configuration, log API activity, manage storefront content, and extend core ERPNext doctypes with Medusa-specific fields. This page catalogues every doctype created by the integration and describes the custom fields added to standard ERPNext doctypes.

Configuration and logging

Medusa Configuration

A Single doctype (one record per site) that holds all settings required for the integration to connect to a Medusa backend:
  • Medusa API base URL
  • Admin email and password used for authentication
  • An Enable checkbox that acts as a global on/off switch for all outbound API calls
If the Enable checkbox is unchecked, no data will be sent to Medusa — not by scheduled tasks, not by document event hooks, and not by manual actions. Always verify this setting when diagnosing sync issues.

Medusa Request Log

An append-only log doctype. Every call made through the send_request() utility in utils.py automatically creates one record here with the following fields:
FieldDescription
status"Success" if the HTTP response was OK, "Failure" otherwise
payloadJSON-serialised request body sent to Medusa
responseJSON-serialised response body (or raw text on failure)
voucher_typeDoctype of the ERPNext document that triggered the call (e.g., "Sales Order")
voucher_nameName of the ERPNext document that triggered the call
Use this doctype as your first stop when investigating why data did not reach Medusa. Navigate to Desk → Medusa Request Log and filter by voucher_type or status to find the relevant entry.
The payload and response fields are stored as pretty-printed JSON, making them easy to read directly in the form view.

Homepage and storefront content

Homepage Landing

A Single doctype that controls the top-level storefront homepage. Key fields include:
  • delivery_charges — flat delivery charge applied to non-Muscat orders
  • price_visibility_threshold — items with a standard price below this value show the price to all visitors; items at or above it show 0 (price on request)
  • Child tables for the top section, menu section, and other homepage layout areas

Homepage Banner

Stores individual banner records (image, link, title) used in homepage carousel or hero sections.

Homepage Item

Stores featured item entries displayed on the homepage.

Homepage Order

Controls the display order of sections on the homepage.

Product collections

Product Collection

A Single doctype with four child tables — one per top-level product category (Dental, Medical, Infection Control, Medical Laboratory IVD). Each child table is refreshed nightly by the add_top_selling_items_to_collection scheduled task with the top 20 best-selling items for that category.

Product Collection Item

The child table doctype used by Product Collection. Each row stores an item_code, item_name, and sales_count.

Customer and order support

Medusa Wishlist

A child table doctype used inside Website Item. Each row stores a medusa_customer_id, representing one customer who has wishlisted the parent item. The handle_wishlist API endpoint adds and removes rows in response to storefront actions.

Website Coupon Code

Stores coupon codes that can be applied during checkout on the Medusa storefront.

Email OTP

Stores one-time password records for storefront authentication. Each record includes the OTP value, associated email address, expiry time, and a used/expired status flag. The expire_otps scheduled task cleans up stale records every minute.

Opportunity Contact

A supporting child table that stores contact details associated with an opportunity or quotation.

Returned Sales Order Item

A child table that records items from a sales order that have been returned.

Increased Items

A child table that tracks items whose quantities were increased during the order review / quotation negotiation workflow.

Item and Brand Entry

A supporting table for associating items with specific brands in various contexts.

Reviews and ratings

Website Item Review

A child table used inside Website Item (as custom_review). Each row stores a customer’s review of the product:
FieldDescription
medusa_idMedusa customer ID of the reviewer
name1Display name of the reviewer
reviewReview text
review_idMedusa-side review identifier
ratingNormalised rating (0–1 scale, where 1 = 5 stars)
dateReview date
likes / dislikesAggregate like/dislike counts
The parent Website Item also stores custom_overall_rating, which is recalculated as a weighted average whenever a review is added or updated.

Clearance and deals

Best Deals

Stores items currently on sale or in a best-deals promotion, updated nightly by fetch_clearance_items.

Expiring Items

Parent doctype for the clearance/expiry tracking feature.

Expiring Items Table

Child table of Expiring Items. Each row represents one item approaching its expiry date.

Storefront content blocks

Product Details Banner

Stores promotional banner content displayed on individual product pages.

Product Suggestions

Stores curated product suggestion sets for upsell/cross-sell sections.

Testimonial

Stores customer testimonials displayed on the storefront.

Youtube Videos

Stores YouTube video entries (URL, title, description) for embedding in storefront pages.

Custom fields on standard ERPNext doctypes

In addition to new doctypes, the integration adds custom fields to several existing ERPNext doctypes. These fields carry the Medusa identifier for each record, enabling the integration to correlate ERPNext data with Medusa data:
DoctypeCustom fieldPurpose
Customermedusa_idMedusa customer ID
Leadmedusa_idMedusa customer ID (before conversion)
Website Itemmedusa_idMedusa product ID
Website Itemmedusa_variant_idMedusa product variant ID
Website Itemcustom_overall_ratingComputed average review rating
Website Itemcustom_skip_update_hookInternal flag to suppress sync on a single save
Website Itemcustom_parent_website_itemLink to parent item for variant grouping
Item Pricemedusa_idMedusa price list ID
Item Pricemedusa_price_idMedusa price entry ID within the price list
Item Groupmedusa_idMedusa collection ID
Item Groupcustom_medusa_routeComputed URL route used by the storefront
Sales Ordermedusa_order_idMedusa order ID
Sales Orderfrom_ecommerceFlag indicating the order originated from the storefront
Quotationmedusa_draft_order_idMedusa draft order ID
Quotationmedusa_quotation_idMedusa quotation ID
Quotationmedusa_order_idMedusa order ID after approval
Quotationfrom_ecommerceFlag indicating the quotation originated from the storefront
Sales Invoicemedusa_order_idInherited from the source Sales Order
Sales Invoicefrom_ecommerceInherited from the source Sales Order
The medusa_id field is the primary link between ERPNext and Medusa. If this field is blank on a record, the integration will attempt to create a new corresponding record in Medusa rather than updating an existing one.

Build docs developers (and LLMs) love