From 918265abe1e2644980ddb727ea95876e98caf79b Mon Sep 17 00:00:00 2001 From: ipatate Date: Tue, 9 Feb 2021 15:00:54 +0100 Subject: [PATCH 1/2] add templatesUrl option --- readme.md | 4 ++++ src/components/Snipcart.jsx | 11 ++++++++++- src/gatsby-ssr.js | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1018a38..c2b17ba 100644 --- a/readme.md +++ b/readme.md @@ -46,6 +46,8 @@ module.exports = { }, }, }, + templatesUrl: + "path on your template file. Set file in the static folder", innerHTML: ` @@ -69,6 +71,7 @@ Read the snipcart document [https://docs.snipcart.com/v3](https://docs.snipcart. - useSideCart : define if the "snipcart" library opens the cart in a side modal - locales : object of locales string. First level of keys is lang key. Example: {fr: {...}} localisation files is here => [https://github.com/snipcart/snipcart-l10n](https://github.com/snipcart/snipcart-l10n) +- templatesUrl: template file for override snipcart element [https://docs.snipcart.com/v3/setup/customization#defining-templates-in-an-external-file](https://docs.snipcart.com/v3/setup/customization#defining-templates-in-an-external-file) - innerHTML : code for override snipcart element customization doc => [https://docs.snipcart.com/v3/setup/customization](https://docs.snipcart.com/v3/setup/customization)) @@ -79,6 +82,7 @@ Default values : - currency : "usd" - openCartOnAdd : true - useSideCart : false +- templatesUrl: null - locales : {} - innerHTML : '' diff --git a/src/components/Snipcart.jsx b/src/components/Snipcart.jsx index 09dd7db..0cad1f4 100644 --- a/src/components/Snipcart.jsx +++ b/src/components/Snipcart.jsx @@ -1,6 +1,13 @@ const React = require("react"); -const Snipcart = ({ publicApiKey, currency, innerHTML, openCartOnAdd, useSideCart }) => ( +const Snipcart = ({ + publicApiKey, + currency, + innerHTML, + openCartOnAdd, + useSideCart, + templatesUrl, +}) => (