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://cdn.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 theobject(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:'electronics' => it will only display try On button for specified category
nonTryOnProductsReport:'boolean'
ex: nonTryOnProductsReport:'true' => it will collect all the non tryon sku from the company
prodRecommendation:'boolean'
ex: prodRecommendation:'true' => it will display the products from camwear dashboard as recommended products
buynow:{object}
buynow
object argumentsproductIdShopify:‘string’
searchProduct:‘boolen’
note:default
closeTryonPopup
is true => true for closing and false won’t close
buynow:{'object'} for buy now
ex: buynow:{enable:'true', productIdShopify:'{{ pid1 }}',closeTryOnPopup:'false'}
note: pass
true
orfalse
toenable
ordisable
.
-> `enable` , `productIdShopify` is required for adding to cart only for shopify stores.
buynow:{'object'} for search products only for shopify
ex: buynow:{enable:'true', searchProduct:'true',closeTryOnPopup:'false'}
note: pass
true
orfalse
toenable
ordisable
.
-> buynow button, searchProduct: `true` for `enable search`, `false` for `no search`, `default is false`.
-> pass eigther `searchProduct or productIdShopify` dont pass both.
-> when passing `searchProduct` no need to pass `buynowCallback` as it servers no use.
buynowCallback:'functionName'
ex: buynowCallback:'mycallbackfunctionName'
note:
page
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'
This is to specify storage region. Default is 0 (mumbai), 1 - cdn for global, 2 - USA Virginia
Ex: regionId: 2
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@camweara.com for any questions.