Created
November 11, 2015 20:24
-
-
Save couellet/98dcadb35fa5c9fd91e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var copyAttribute = function (attr, source, target, altAttr) { | |
if (!!altAttr && !!source.data(altAttr)) { | |
target.data(attr, source.data(altAttr)); | |
} | |
else { | |
target.data(attr, source.data(attr)); | |
} | |
}; | |
var setSnipAttributes = function (item) { | |
copyAttribute('item-id', item, opts.target); | |
copyAttribute('item-name', item, opts.target); | |
copyAttribute('item-price', item, opts.target, 'data-item-price-rebate'); | |
copyAttribute('item-url', item, opts.target); | |
copyAttribute('item-max-quantity', item, opts.target); | |
copyAttribute('item-description', item, opts.target); | |
copyAttribute('item-taxable', item, opts.target); | |
copyAttribute('item-taxes', item, opts.target); | |
copyAttribute('item-shippable', item, opts.target); | |
copyAttribute('item-image', item, opts.target); | |
App.mediator.notify('snipcart.refresh'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment