Prerequisites

You should have

  • an user-account enabled for api access, cart access and marketplace access
  • an api-client
  • at least one product-record stored in the Hublify PIM
  • at least one merchant with a product in the Hublify Marketplace

Short facts

You can include products from other merchants into your cart if your Hublify system is configured for marketplace use. The cart-API also handles the business logic related to these products.

This includes

  • Multi-Merchant Carts
    e.g. products from different merchants, all with their specific prices incl. price-scales, availability checks etc.
  • Including different versions of the same base-product in the same cart
    e.g. from either different merchants or in different conditions.
  • Products that you offer yourself can be combined with products from other merchants.

Add Merchant specific products to the cart

To include a merchant-specific product, you only need to provide the specific "prcmrch_id" for this merchant-product on top of the always provided cart-id and product-code when you add a product to the cart.
Price and quantity will be added based on the Hublify-data for the product.

The "prcmrch_id" for merchant-products is the primary value of a merchant-product and marks it as a merchant-specific variant of this product.

Request URL

https://{your hublify url}/api/eos_10/cart_addProducts

Request parameter

{
   "filter": {
        "cart_id": 123
   },
   "fields": {
        "cart_items": [             // Array with products that should be added
            {
                "pcode": "PC0001",  // Product-Code. If the Product is available in Hublify PIM
                "quantity": 1,      // (optional, default: min-order-quantity set in PIM, usually 1) 
                "xdata": {
                    "prcmrch_id": "234" // The internal ID identifying the merchant-specific version of this product "prcmrch_id":234
                }
            }
        ]
    },
    "evaluate": true                // (optional) directly reevaluate the cart
}

Response

If your request was successful, you receive the adjusted cart-data with some additional details for your convenience.
For your merchant-products the cart-items and summary parts will be enriched with some additional details.

 

{
    "status": true,
    "meta": {                           // Summary of the latest call
        "products_added": 1,            // number of products added to the cart
        "items": {                      // Details about the added products
            "PC0001": {                
                "quantity_added": 1     // Quantity added for this specific product
            }
        }
    },
    "data": {
        "cart_items": [
            {
                "quantity": 1,
                "pcode": "PC0001",
                "vat_pct": 19,
                "xdata": {
                    "pkey": "m-234",
                    "prcmrch_id": "234",                 // the merchant-product specific price-id
                    "mrch_id": "2",                      // the ID for the merchant
                    "mrch_code": "MRCH00002",            // the merchant-code
                    "prcmrch_pcode_merchant": "MM0001",  // a merchant specific product-code for this 
                    "prcmrch_condition": "new",          // the condition of this product (if configured)
                    "cart_grouping_key": "PC0001---234", // a cart internal grouping key
                                                         // to allow different versions of the same base-product
                    "xtext_i18n": {            
                        "prcmrch": {
                            "string": "ecs_plugin_merchant.item_text_merchant_product",
                            "vars": {
                                "mrch_name": "Max Merchant",
                                "prcmrch_condition": "new",
                                "prcmrch_description": null
                            }
                        },
                        "prcmrch_by_condition": {
                            "string": "ecs_plugin_merchant.item_text_merchant_product__condition_new",
                            "vars": {
                                "mrch_name": "Max Merchant",
                                "prcmrch_condition": "new",
                                "prcmrch_description": null
                            }
                        }
                    },                
                    "price_scale": null,
                    "price_data_original": {
                        "price_single_brutto": 14.56,
                        "vat_pct": "19.00"
                    },
                    "currency_convert_rates": {
                        "EUR": "1.0000"
                    }
                },
                "type": "product",
                "block": 1,
                "price_single_brutto": 14.56,
                "name": "Example Product 1"
            }
        ],
        ...                                                               // other details as described in cart-get  
        "summary": { 
            ...                                                           // other summary details as described in cart-get  

            "merchant": {                                                 // a merchant grouped version of the summary 
                "2": {              
                     "cart_total_quantity": 1,                            // quantity for this merchant
                     "cart_total_netto": 12.24,                           // total netto for this merchant
                     "cart_total_brutto": 14.56,                          // total brutto for this merchant     
                     "cart_prds_quantity": 1,
                     "cart_prds_netto": 12.24,
                     "cart_prds_brutto": 14.56,
                     "summary": {
                         "prds_pure_virtual": false,
                         "weight_total": 0,
                         "vats": {
                             "19": {
                                 "total_netto": 12.24,
                                 "total_brutto": 14.56,
                                 "total_vat": 2.32,
                                 "items_netto": 12.24,
                                 "items_brutto": 14.56,
                                 "items_vat": 2.32
                             }
                         },
                         "blocks": {
                             "1": {
                                 "total_netto": 12.24,
                                 "total_brutto": 14.56,
                                 "total_vat": 2.32,
                                 "items_netto": 12.24,
                                 "items_brutto": 14.56,
                                 "items_vat": 2.32
                             }
                         },
                         "items": {
                             "PC0001": {
                                 "quantity": 1,
                                 "occurrences": 1,
                                 "total_netto": 12.24,
                                 "total_brutto": 14.56,
                                 "total_vat": 2.32
                             }
                         },
                         "type": {
                             "product": {
                                 "quantity": 1,
                                 "occurrences": 1,
                                 "total_netto": 12.24,
                                 "total_brutto": 14.56,
                                 "total_vat": 2.32
                             }
                         },
                         "order_min_limit_OK": true
                     },
                     "checkout": {
                         "purchase": true,
                         "msg": null
                    },
                    "mrch_data": {                             // aditional data for this mercahnt
                        "mrch_id": "2",                        // id for this merchant
                        "mrch_code": "MRCH00002",              // merchant code 
                        "mrch_name": "Max Merchant",           // name of this merchant 
                        "mrch_xsettings": null,                // additional settings specific to this merchant 
                        "country": "DE",                       // country this merchant is located in 
                    }
                }
            }
        }
    }
}