Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aimahdi/a64b7abaa6d491d522fcea6ee63ab539 to your computer and use it in GitHub Desktop.

Select an option

Save aimahdi/a64b7abaa6d491d522fcea6ee63ab539 to your computer and use it in GitHub Desktop.

Enable Subscription order creation using snippet

add_filter('fluent_cart/order/is_subscription_allowed_in_manual_order', function(){
    return true;
});

API Endpoint: /wp-json/fluent-cart/v2/orders

Authentication: Basic username:applicationpassword

payload

{
    "applied_coupon": {
        "ripon": {
            "id": 1,
            "title": "Ripon",
            "amount": 0,
            "formatted_discount": "€3,00",
            "unit_amount": 300,
            "actual_quantity": 1,
            "discount": 300,
            "type": "fixed",
            "actual_amount": "300",
            "actual_formatted_discount": "€3,00",
            "formatted_title": "ripon"
        }
    },
    "customer_id": 22,
    "status": "processing",
    "subtotal": 12900,
    "manual_discount_total": 0,
    "shipping_tax": 0,
    "shipping_total": 0,
    "tax_total": 0,
    "total_amount": 12600,
    "order_items": [
        {
            "id": 119,
            "post_id": 492,
            "object_id": 119,
            "price": 12900,
            "unit_price": 12900,
            "item_cost": 0,
            "featured_media": "http://domain.com/wp-content/uploads/2025/10/crm_logo_black.webp",
            "quantity": 1,
            "post_title": "FluentCRM",
            "title": "Solo/Blogger",
            "fulfillment_type": "digital",
            "manage_stock": "0",
            "stockStatus": "in-stock",
            "available": null,
            "soldIndividually": 0,
            "checked": true,
            "disable": false,
            "other_info": {
                "description": "",
                "payment_type": "subscription",
                "times": "",
                "repeat_interval": "yearly",
                "trial_days": "",
                "billing_summary": "",
                "manage_setup_fee": "no",
                "installment": "no"
            },
            "payment_type": "subscription",
            "tax_amount": 0,
            "shipping_charge": 0,
            "discount_total": 300,
            "updated_stock": null,
            "total": 12900,
            "line_total": 12600,
            "subtotal": null
        }
    ],
    "payment_status": "pending",
    "payment_method": "mollie",
    "shipping_status": "unshipped",
    "coupon_discount_total": 300,
    "billing_address_id": 45,
    "shipping_address_id": 46,
    "discount": {},
    "shipping": {},
    "labels": [],
    "user_tz": "Asia/Dhaka",
    "trigger": "on_admin_create",
    "query_timestamp": 1764240772265
}

Adjust the data above according to your requirement.

API response

{
    "message": "Order created successfully!",
    "order_id": 60
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment