I am trying to add a checkbox for the shipping in formation so that if it is checked the billing information is saved as shipping information. I have added this to cart.js
//Shipping address check
jQuery('body').on('click', '.cartContainer.information button[type=submit]', function () {
if (jQuery('#saveDetails').is(':checked')) {
var properties = {
shippingfirstName: $("#inputFirstName").val(),
shippinglastName: $("#inputLastName").val(),
shippingcompany: $("#inputCompany").val(),
shippingstreetAddress: $("#inputAddress").val(),
shippingzipCode: $("#inputZipCode").val(),
shippingcity: $("#inputCity").val()
I plan on adding this checkbox as a custom property which can then be set and saved alongside the shipping details. Can somebody help me with my issue please. We are planning to go live soon.
Also I would like to know how to obtain the storeId in the JavaScript api. I do have _storeId = @Model.Store; in my master template. Do I just use _storeId within the js.
If you have the variable _storeId, then Tea Commerce will pick it up and you don't need to send it as a parameter to your methods.
I would just save the checkbox value as you won't want your UI to have the billing info copied to the fields with shipping information. Then at the right point (properly when the order is finalized) you will use the Notification center to copy the values to the shipping info at that point. https://documentation.teacommerce.net/net-api/notification-center/
Thanks for your reply. I was hoping to use javascript api for this. Can order properties not be updated using js? My main problem is TC.addOrUpdateOrderProperties within js is not updating or storing the property.
Adding checkbox for shipping address
Hi,
I am trying to add a checkbox for the shipping in formation so that if it is checked the billing information is saved as shipping information. I have added this to cart.js
//Shipping address check jQuery('body').on('click', '.cartContainer.information button[type=submit]', function () { if (jQuery('#saveDetails').is(':checked')) { var properties = { shippingfirstName: $("#inputFirstName").val(), shippinglastName: $("#inputLastName").val(), shippingcompany: $("#inputCompany").val(), shippingstreetAddress: $("#inputAddress").val(), shippingzipCode: $("#inputZipCode").val(), shippingcity: $("#inputCity").val()
The order properties are not getting saved though. I am not sure what else I have to add.
I plan on adding this checkbox as a custom property which can then be set and saved alongside the shipping details. Can somebody help me with my issue please. We are planning to go live soon.
Also I would like to know how to obtain the storeId in the JavaScript api. I do have _storeId = @Model.Store; in my master template. Do I just use _storeId within the js.
Hi Preethi
If you have the variable _storeId, then Tea Commerce will pick it up and you don't need to send it as a parameter to your methods.
I would just save the checkbox value as you won't want your UI to have the billing info copied to the fields with shipping information. Then at the right point (properly when the order is finalized) you will use the Notification center to copy the values to the shipping info at that point. https://documentation.teacommerce.net/net-api/notification-center/
Kind regards
Anders
Hi Anders,
Thanks for your reply. I was hoping to use javascript api for this. Can order properties not be updated using js? My main problem is TC.addOrUpdateOrderProperties within js is not updating or storing the property.
Regards
Preethi
Yes it can - just use this method.
https://documentation.teacommerce.net/javascript-api/order-properties/addorupdateorderproperties/
Kind regards
Anders
is working on a reply...