ms.cart

This object contains the current cart information.

Note: If you want to refer to ms.cart widget, then, visit here.


Variables

Value Description
_id It is the unique alphanumeric identifier for the cart. It is used to differentiate between carts and users. It is also used to call API.
available_options It contains the list of available order options defined in a store. It is the instance of ms.order_options.
available_payment_methods It contains the list of available payment methods for the cart. It is available on front end as well as back end scope. It is not send to database. It is the instance of ms.payment_methods.
additional_charges It is an array of object containing details of additional charges.
available_shipping_methods It contains the list of available shipping method for the cart. It is available on front end as well as in back end scope. It is not send to database.
billing_address The billing address is associated with the payment method. This address is an optional field that will not be available on orders that do not require one. It has the following properties:
full_name: The full name of the person associated with the payment method.
address: The street address of the billing address.
city: The city of the billing address.
state: The state of the billing address.
country: The name of the country of the billing address.
zip: The zip or postal code of the billing address.
phone: The phone number at the billing address.
client_details The object contains the detail of the client system. These details are gathered for navigator object of JavaScript.
coupon_code It contains the code applied by a user in order to avail any sort of discount.
currency It is the object containing name and conversion_rate of currency
currency_code This contain the conversion rate of the currency of the currency code.
currency_rate:'0.14'
discounts It is an array of object containing details of cart level discounts.
{ "_id":"53b256e9b3af14aa15e451a5",
"saving_amount":50,
"coupon_code":"HIPPO" }
discounts_total It is the total value of cart level discount. It has numeric value.
email_id This object contains the email id of customer.
item_count It contains the total numbers of items which are added to cart.
items This object contains an array of items which are added to the cart. Array contains item_id, name, alias, discounts and other details.
user_id The object contains the total amount payable for placing the order on the cart.
total The object contains the total amount payable for placing order on the cart.
taxes_total The object contains the total tax amount charged on the cart.
total_weight The object carries summation of the weight of all items in the cart.
shipping_method It contains the object of shipping method which is currently applied to cart object. This contains _id, name and price of shipping method.
payment_method It contains the object of payment gateway which is currently applied on cart object. This contains _id, name, type and settings of payment method.
available_shipping_charges It contains the list of available shipping charges applicable on the cart.
available_wallets It contains the list of available wallets defined in a store.
discounts_percentage It is the total value of cart level discount. It has percentage value.
ecoupon It contains the information about the coupon applied on the cart.
options It contains the information about the order options applied on the cart.
shipping_address The shipping address is associated with the payment method. This address is mandatory. It has the following properties:
full_name: The full name of the person associated with the payment method.
address: The street address of the shipping address.
city: The city of the shipping address.
state: The state of the shipping address.
country: The name of the country of the shipping address.
zip: The zip or postal code of the shipping address.
phone: The phone number at the shipping address.
shipping_charges It is an array of object containing details of the shipping charges applied on the cart.
shipping_total This object contains the total shipping amount charged on the cart.
wallets It is an array of object containing details of the wallets used for cart.
sub_total It contains the total amount of the cart before any shipping charges or taxes are applied on the cart.
taxes It is an array of object containing details of cart level taxes.

Methods

Value Description
getUserCart This API is used to get cart of the user. If any other cart is present, then the user cart and current cart is merged. This API is called when the user logs in or the user is getting registered. It picks the user id from the current session.
updateCart The API is used to override the content of the existing cart.
getCart The API is used to retrieve the cart with a valid unique identifier. If cart with given _id is present and valid, then same cart is returned else a new empty cart is returned.
updateQuantity The API is used to add a product to an existing cart, and return the updated cart.
addItem The method is used to add products to the current user cart. It requires product and product quantity as parameters.
removeItem This method is used to remove products from the current user cart. It requires the product as parameter which you want to remove from the cart.
applyCoupon This method is used to apply the coupon to the current user cart. It requires coupon code as parameter which a user wants to apply on the cart.
removeCoupon This method is used to remove coupon from the current user cart.
updateAddresses The method is used to update user billing and shipping address to the current user cart. It requires the billing and shipping address as parameters.
updateShippingMethod The method is used to update shipping methods in the cart. It is helpful when the cart has more than one shipping method applicable. By default, the first shipping method is updated from the back end. This method requires method id as the parameter which the user wants to apply on the cart.
updatePaymentMethod The method is used to update payment methods in the cart. It is only helpful when the cart have more than one payment methods is present. By default, the first payment method is applied on cart from the back end. This method requires payment method details as parameters.
placeOrder This method is used to place an order. With a click, the order gets placed directly in case of cash on delivery payment method, and the user gets redirect to the payment gateway page in case of any online payment method.