Example code snippet
<script onload="loadTryOnButton({
psku:'earring6',
page:'product',
company:'Teststore',
buynow:{enable:'true'}
prependButton:{class:'product-form'},
MBprependButton:{class:'product-main_div'},
styles:{
tryonbutton:{backgroundColor:'white',color:'black',border:'1px solid black',borderRadius:'25px'},
tryonbuttonHover:{backgroundColor:'black',color:'white',border:'none',borderRadius:'25px'},
MBtryonbutton:{width:'100%',borderRadius:'25px'}
},
tryonButtonData:{text:'Virtual Try-On',faIcon:'fa fa-camera'},
});"
src="https://camweara.com/integrations/camweara_api.js"></script>
loadTryOnButton function arguments
psku:{'string'}
ex1: psku:{'sku name'} => this will get only the passed sku on virtual tryon
psku:{object}
ex2: psku:{main:'sku name',recommendedSkus:'array or sku name'} => this will get the passed sku with recommended skus on virtual tryon
note: The psku will accept srting and object , passing string(sku name) will get only the passed sku (ref: ex1) and passing the object(main:sku name,recommendedSkus:array or string) will load the sku with passed recommended skus (ref:ex2)
company:{'string'}
ex: ex: company:{'company name'}
page:{'string'}
ex: page:{'listing'}
productCategory:{'string'}
ex: productCategory:{'specs'} // it will only display try On button for specified category
buynow:{object}
buynow
object argumentsnote:default closeTryonPopup is true // true for closing and false won’t close
ex: buynow:{enable:'true', productIdShopify:'{{ pid1 }}',closeTryOnPopup:'false'}
note: pass true or false to enable or disable
buynow button, productIdShopify is required for adding to cart only for shopify stores.
buynowCallback:{'functionName'}
ex: buynowCallback:{'mycallbackfunctionName'}
note: page or accepts listing or product as of now
appendButton:{'object'}
ex-1: appendButton:{id:'id of the element'} //to append the tryon button
ex-2: appendButton:{class:'class of the element'} //to append the tryon button
Note:
->you can only pass id if page:{‘listing’}
->appendButton will place the tryon button after div
prependButton:{'object'}
ex-1: prependButton:{id:'id of the element'} //to prepend the tryon button
ex-2: prependButton:{class:'class of the element'} //to prepend the tryon button
Note:
-> you should only pass id if page:{‘listing’}
-> prependButton will place the tryon button before div
styles:{'object'}
styles
object argumentstryonbutton:{styles}
ex: styles:{tryonbutton:width:'100%',borderRadius:'25px'} //styles for tryon button
tryonbuttonHover:{styles}
ex: styles:{tryonbuttonHover:backgroundColor:'black',borderRadius:'15px'} //styles for tryon button on Hover
MBtryonbutton:{styles}
ex: styles:{MBtryonbutton:width:'100%',borderRadius:'25px'} //styles for tryon button for mobile width
MBtryonbuttonHover:{styles}
ex: styles:{MBtryonbuttonHover:backgroundColor:'black',borderRadius:'15px'} //styles for tryon button on Hover for mobile width
tryonbuttonData:{object}
tryonbuttonData
object
argumentstext:{string}
ex: tryonbuttonData:{text:'Try virtualy'} //text shows on tryon button
faIcon:{string}
ex: tryonbuttonData:{faIcon:'fa fa-camera'} //only fontawasome classname
note: faIcon only accepts Font Awesome 4 Icon classes
getSkusListWithTryOn({}) // function
function arguments
ex: getSkusListWithTryOn({companyName:'your company name'}).then((skulist)=> console.log(skulist)) // result will be an array
note:
-> getSkusListWithTryOn is a asynchronous function
-> before calling getSkusListWithTryOn make sure the api script tag is added
<scrip src="https://camweara.com/integrations/camweara_api.js" ></script> and then call the function after the script tag or if the script tag is added in head tag then call the function anywere in your code as in the above example
Reach us at info@modakatech.com for any questions.