Product status deleteFromCart
    • 1 Minute to read
    • Dark
      Light

    Product status deleteFromCart

    • Dark
      Light

    Article summary

    You can analyze in detail which products on your website are deleted in the shopping cart. "DeleteFromCart" is usually set as the status when a product or number of products is removed from the cart.

    Methods

    The deleteFromCart object contains the following four methods, which are contained in the objects data and parameter:

    • set: Overwrites all existing values.

    • add: Overwrites only the corresponding values.

    • get: Returns the current configuration.

    • remove: Removes the current configuration or individual values.

    data

    set

    /**
     * @param {{
     *      id: string,
     *      [cost=0]: number,
     *      [quantity=0]: number,
     *      [soldOut=false]: boolean,
     *      [parameter={}]: {[number]: string},
     *      [category={}]: {[number]: string}
     * }[]} data
     *
     * @returns {wtSmart.product.deleteFromCart.data}
     */
    wtSmart.product.deleteFromCart.data.set(data);

    JS

    add

    /**
     * @param {{
     *      id: string,
     *      [cost=0]: number,
     *      [quantity=0]: number,
     *      [soldOut=false]: boolean,
     *      [parameter={}]: {[number]: string},
     *      [category={}]: {[number]: string}
     * }[]} data
     *
     * @returns {wtSmart.product.deleteFromCart.data}
     */
    wtSmart.product.deleteFromCart.data.add(data);

    get

    /**
     * @returns {{
     *      id: string,
     *      cost: number,
     *      quantity: number,
     *      soldOut: boolean,
     *      parameter: {[number]: string},
     *      category: {[number]: string}
     * }[]}
     */
    wtSmart.product.deleteFromCart.data.get();

    remove

    /**
     * @param {number[]} [removeDeleteFromCart]
     *
     * @returns {wtSmart.product.deleteFromCart.data}
     */
    wtSmart.product.deleteFromCart.data.remove(removeDeleteFromCart);

    Example

    var product = {
        id: 'ABC-123',
        cost: 99.90,
        quantity: 2,
        soldOut: false,
        parameter: {
            1: 'L'
        },
        category: {
            1: 'tops',
            2: 'noname'
        }
    };
    
    // set product deleteFromCart data
    wtSmart.product.deleteFromCart.data.set([product, product2]);
    
    // add product deleteFromCart data
    wtSmart.product.deleteFromCart.data.add([product3, product4]);
    
    // get product deleteFromCart data
    var data = wtSmart.product.deleteFromCart.data.get();
      
    // remove all product deleteFromCart data
    wtSmart.product.deleteFromCart.data.remove();
    
    // remove only the first (product) product deleteFromCart data
    wtSmart.product.deleteFromCart.data.remove([1]);

    parameter

    set

    /**
     * @param {{[number]: string}} data
     *
     * @returns {wtSmart.product.deleteFromCart.parameter}
     */
    wtSmart.product.deleteFromCart.parameter.set(data);

    add

    /**
     * @param {{[number]: string}} data
     *
     * @returns {wtSmart.product.deleteFromCart.parameter}
     */
    wtSmart.product.deleteFromCart.parameter.add(data);

    get

    /**
     * @returns {{[number]: string}}
     */
    wtSmart.product.deleteFromCart.parameter.get();

    remove

    /**
     * @param {number[]} [removeDeleteFromCart]
     *
     * @returns {wtSmart.product.deleteFromCart.parameter}
     */
    wtSmart.product.deleteFromCart.parameter.remove(removeDeleteFromCart);

    Example

    // set product deleteFromCart parameter
    wtSmart.product.deleteFromCart.parameter.set({
        1: 'bar'
    });
    
    // add product deleteFromCart parameter
    wtSmart.product.deleteFromCart.parameter.add({
        7: 'foo.bar'
    });
    
    // get product deleteFromCart parameter
    var data = wtSmart.product.deleteFromCart.parameter.get();
      
    // remove all product deleteFromCart parameter
    wtSmart.product.deleteFromCart.parameter.remove();
    
    // remove only product deleteFromCart parameter 7
    wtSmart.product.deleteFromCart.parameter.remove([7]);

    Code Generator

    Use the code generator to create individual code that you can then integrate directly into the website.


    Was this article helpful?