Adding products to a cart

You can add products one by one or multiple products at once

Request

You only need to provide the cart-id and product-code to add a product to the cart.
Price and quantity will be added based on the Hublify-data for the product.

Attention: On default only products that are marked as buyable will be accepted.

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, the other item-details can be filled from there.
                "quantity": 1,          // Amount to add to the cart for this product default: min-order-quantity set in PIM, usually 1),
                "mode_add": "group"     // How should this item be added to the cart
                                        // (optional, default: "group")
                                        // "group": If already an item with the same [pcode] exists, 
                                        //          then its [quantity] is simply increased. 
                                        //          Other Item fields are not added or updated in the cart.
                                        // "group_not": In case of already existing other [pcode]-cartItems, 
                                        //              it is not added to them. Instead, 
                                        //              a new cart-item-Subarray is created in any case.
            }
        ]
    },
    "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.
If no other data has been set before, the cart will also be initialised with the default order-options (invoice- and delivery country, shipping type and payment-method)

If you already have the exact same product in your cart (same pcode, vat, price), your requested quantity will be added to the existing item by default. Set "mode_add": "group_not" to create a new cartItem instead.

The Cart will automatically adjust the request to fulfill the product-requirements set in the PIM (e.g. min/max order-quantity).
You can see details about the actual quantities newly added to your cart ("quantity_added") and the new total quantity for this product ("quantity_final") in the meta-data you receive in the response.

Tipp:  The cart will also automatically consider personal prices, price scales and other product details configured in the Hublify PIM.

{
    "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 that was actually added for this specific product (after adjustment for PIM-requirements)
                "quantity_final": 1     // New total quantity in the cart for this specific item (sum of previous and newly added quantity)
            }
        }
    },
    "data": ...                         // As described in cart-get  
}

Update products in the cart

You can adjust e.g. quantities for one or more  products in the cart

Request

You need the cart-id and the key of the item to update within the cart_items array to update it
 

Request URL

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

Request parameter

{
   "filter": {
        "cart_id": 123
   },
   "fields": {
        "cart_items": [                 // Array with products that should be updated
             "0": {
                "quantity": 3           // You only need to add the details you want to update
            }
        ]
    },
    "evaluate": true                    // (optional) directly reevaluate the cart
}

Response

If your request was successful, you receive the adjusted cart-data.

The Cart will automatically adjust the request to fulfill the product-requirements set in the PIM (e.g. min/max order-quantity)

Tipp:  The cart will also automatically consider personal prices, price scales and other product details configured in the Hublify PIM.

{
    "status": true,
    "data": {
        "cart_id": "123",
        "cart_data": {
            "currency": "EUR",
            "cart_item_key": 1,
            "order": {
                "invoice_country": "DE",
                "deliver_country": "DE",
                "fk_o_st_id": "1"
            },
            "payment": {
                "pys_id": "1"
            },
            "currency_dsp": "\u20ac"
        },
        "cart_items": [
            {
                "quantity": 3,
                "pcode": "PC0001",
                "vat_pct": 19,
                "xdata": {
                    "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"
            }
        ],
        "cart_prds_quantity": 3,
        "cart_prds_netto": 36.71,
        "cart_prds_brutto": 43.68,
        "cart_total_quantity": 3,
        "cart_total_netto": 36.71,
        "cart_total_brutto": 43.68,
        "cart_lock": "0",
        "cart_prds_lock": "0",
        "cart_time_insert": "2021-06-14 16:30:22",
        "cart_time_update": "2021-06-14 17:04:58",
        "cart_time_out": null,
        "cart_time_save": null,
        "fk_cart_persid": "0",
        "cart_type": "open",
        "cart_name": "",
        "summary": {
            "prds_pure_virtual": false,
            "weight_total": 0,
            "vats": {
                "19": {
                    "total_netto": 36.71,
                    "total_brutto": 43.68,
                    "total_vat": 6.97,
                    "items_netto": 36.71,
                    "items_brutto": 43.68,
                    "items_vat": 6.97
                }
            },
            "blocks": {
                "1": {
                    "total_netto": 36.71,
                    "total_brutto": 43.68,
                    "total_vat": 6.97,
                    "items_netto": 36.71,
                    "items_brutto": 43.68,
                    "items_vat": 6.97
                }
            },
            "items": {
                "PC0001": {
                    "quantity": 3,
                    "occurrences": 1,
                    "total_netto": 36.71,
                    "total_brutto": 43.68,
                    "total_vat": 6.97
                }
            },
            "type": {
                "product": {
                    "quantity": 3,
                    "occurrences": 1,
                    "total_netto": 36.71,
                    "total_brutto": 43.68,
                    "total_vat": 6.97
                }
            },
            "order_min_limit_OK": true
        },
        "checkout": {
            "purchase": true,
            "msg": null
        }
    }
}

Remove products from the cart

Request URL

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

Request with item-key

You need the cart-id and the item-id to remove it

Request parameter

{
   "filter": {
        "cart_id": 123,
        "item_id": 0
   }
}

Request with pcode

You need the cart-id and product-code to remove thie item
If you use the pcode to remove products, ALL items with this pcode will be removed

Request parameter

{
   "filter": {
        "cart_id": 123,
        "pcode": "PC0001"
   }
}

Response

If your request was successful, you receive the adjusted cart-data

{
    "status": true,
    "data": {
        "cart_id": "123",
        "cart_data": {
            "currency": "EUR",
            "cart_item_key": 1,
            "order": {
                "invoice_country": "DE",
                "deliver_country": "DE",
                "fk_o_st_id": "1"
            },
            "payment": {
                "pys_id": "1"
            },
            "currency_dsp": "\u20ac"
        },
        "cart_items": [],
        "cart_prds_quantity": 0,
        "cart_prds_netto": 0,
        "cart_prds_brutto": 0,
        "cart_total_quantity": 0,
        "cart_total_netto": 0,
        "cart_total_brutto": 0,
        "cart_lock": "0",
        "cart_prds_lock": "0",
        "cart_time_insert": "2021-06-14 16:30:22",
        "cart_time_update": "2021-06-14 17:05:13",
        "cart_time_out": null,
        "cart_time_save": null,
        "fk_cart_persid": "0",
        "cart_type": "open",
        "cart_name": "",
        "summary": {
            "prds_pure_virtual": true,
            "weight_total": 0,
            "order_min_limit_OK": true
        },
        "checkout": {
            "purchase": true,
            "msg": null
        }
    }
}