Create Composite Product

Sample request on how to create a wholesale composite product:

POST: /wp-json/wholesale/v1/products

JSON Body:
{
    "name": "Build Your Ninja Outfit",
    "type": "composite",
    "description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
    "short_description": "In pretium enim justo, at ornare libero aliquam quis.",
    "composite_layout": "single",
    "regular_price": "50",
    "wholesale_price": {
        "wholesale_customer": "22"
    },
    "wholesale_visibility_filter": "wholesale_customer",
    "wholesale_minimum_order_quantity": {
        "wholesale_customer": "2",
        "sample_role": "3"
    },
    "wholesale_order_quantity_step": {
        "wholesale_customer": "6",
        "sample_role": "7"
    },
    "ignore_cat_level_wholesale_discount": "yes",
    "ignore_role_level_wholesale_discount": "yes",
    "wholesale_quantity_discount_rule_mapping": [
        {
            "wholesale_role": "wholesale_customer",
            "start_qty": "11",
            "end_qty": "20",
            "price_type": "percent-price",
            "wholesale_price": "20"
        }
    ]
}

Response:

{
    "id": 7089,
    "name": "Build Your Ninja Outfit",
    "slug": "build-your-ninja-outfit",
    "permalink": "https://example.com/product/build-your-ninja-outfit/",
    "date_created": "2021-10-21T06:42:37",
    "date_created_gmt": "2021-10-21T06:42:37",
    "date_modified": "2021-10-21T06:42:37",
    "date_modified_gmt": "2021-10-21T06:42:37",
    "type": "composite",
    "status": "publish",
    "featured": false,
    "catalog_visibility": "visible",
    "description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
    "short_description": "In pretium enim justo, at ornare libero aliquam quis.",
    "sku": "",
    "price": "50",
    "regular_price": "50",
    "sale_price": "",
    "date_on_sale_from": null,
    "date_on_sale_from_gmt": null,
    "date_on_sale_to": null,
    "date_on_sale_to_gmt": null,
    "on_sale": false,
    "purchasable": true,
    "total_sales": 0,
    "virtual": false,
    "downloadable": false,
    "downloads": [],
    "download_limit": -1,
    "download_expiry": -1,
    "external_url": "",
    "button_text": "",
    "tax_status": "taxable",
    "tax_class": "",
    "manage_stock": false,
    "stock_quantity": null,
    "backorders": "no",
    "backorders_allowed": false,
    "backordered": false,
    "low_stock_amount": null,
    "sold_individually": false,
    "weight": "",
    "dimensions": {
        "length": "",
        "width": "",
        "height": ""
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": 0,
    "reviews_allowed": true,
    "average_rating": "0",
    "rating_count": 0,
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "purchase_note": "",
    "tags": [],
    "images": [],
    "attributes": [],
    "default_attributes": [],
    "variations": [],
    "grouped_products": [],
    "menu_order": 0,
    "price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>50.00</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
    "related_ids": [
        6514,
        6361,
        7047,
        6542,
        6376
    ],
    "stock_status": "instock",
    "composite_layout": "single",
    "composite_add_to_cart_form_location": "default",
    "composite_editable_in_cart": false,
    "composite_sold_individually_context": "product",
    "composite_shop_price_calc": "defaults",
    "composite_components": [],
    "composite_scenarios": [],
    "bundle_layout": "",
    "bundle_add_to_cart_form_location": "",
    "bundle_editable_in_cart": false,
    "bundle_sold_individually_context": "",
    "bundle_item_grouping": "",
    "bundle_min_size": "",
    "bundle_max_size": "",
    "bundled_by": [],
    "bundled_items": [],
    "wholesale_data": {
        "wholesale_price": {
            "wholesale_customer": "22"
        },
        "wholesale_minimum_order_quantity": {
            "wholesale_customer": "2"
        },
        "wholesale_order_quantity_step": {
            "wholesale_customer": "6"
        },
        "wwpp_product_wholesale_visibility_filter": [
            "wholesale_customer"
        ],
        "wwpp_ignore_cat_level_wholesale_discount": "yes",
        "wwpp_ignore_role_level_wholesale_discount": "yes",
        "wwpp_enable_quantity_discount_rule": "yes",
        "wwpp_quantity_discount_rule_mapping": {
            "desc": "Quantity based discounts available based on how many items are in your cart.",
            "mapping": [
                {
                    "wholesale_role": "wholesale_customer",
                    "start_qty": "11",
                    "end_qty": "20",
                    "price_type": "percent-price",
                    "wholesale_price": "20"
                }
            ]
        }
    }
}

Last updated