GithubHelp home page GithubHelp logo

xaptor / commercelayer-cart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from commercelayer/mfe-cart

0.0 0.0 0.0 1.39 MB

Commerce Layer Hosted Cart

Home Page: https://commercelayer.io

License: MIT License

JavaScript 3.28% TypeScript 93.80% CSS 2.19% HTML 0.73%

commercelayer-cart's Introduction

Commerce Layer Cart

The Commerce Layer Cart application (React) provides you with a production-ready shopping cart powered by Commerce Layer APIs. You can fork this repository and deploy it to any hosting service or use it as a reference application to build your own. A hosted version is also available.

Commerce Layer Cart demo

What is Commerce Layer?

Commerce Layer is a multi-market commerce API and order management system that lets you add global shopping capabilities to any website, mobile app, chatbot, wearable, voice, or IoT device, with ease. Compose your stack with the best-of-breed tools you already mastered and love. Make any experience shoppable, anywhere, through a blazing-fast, enterprise-grade, and secure API.

Table of contents


Getting started

  1. Create your organization and get your credentials by following one of our onboarding tutorials.

  2. Configure the selfHostedSlug property in /public/config.json to match your organization slug (subdomain).

  3. Deploy the forked repository to your preferred hosting service or host it yourself. You can deploy with one click below:

Deploy to Netlify Deploy to Vercel Deploy to Heroku Deploy to Digital Ocean

  1. Build your sales channel with your favorite technologies and frameworks by leveraging our developer resources and documentation.

  2. Get an access token for your application. You should generate this in your sales channel or use our Javascript authentication library.

  3. Create an order associated with some line items.

  4. View the cart associated with the previously created order using the URL format: <your-deployed-cart-url>/:order_id?accessToken=<your-access-token>.

Example

https://cart.yourbrand.com/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9

Hosted version

Any Commerce Layer account comes with a hosted version of the Cart application that is automatically enabled. You can customize it by adding your organization logo, favicon, primary color, and Google Tag Manager ID.

You can use the hosted version of the Cart application with the following URL format: https://<your-organization-subdomain>.commercelayer.app/cart/:order_id?accessToken=<your-access-token>

Example

https://yourbrand.commercelayer.app/cart/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9

Embedding the cart

The cart can be embedded in your application or website by loading the hosted URL in an inline frame. This way a compact version of the Cart app that doesn't show the header and the footer will be automatically rendered.

Example

// hosted
<iframe src="https://cart.yourbrand.com/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9" width="100%" />

// forked
<iframe src="https://yourbrand.commercelayer.app/cart/PrnYhoVeza?accessToken=eyJhbGciOiJIUzUxMiJ9" width="100%" />

You can either set your iFrame to a fixed height or keep it responsive using the iFrame Resizer library โ€” the Cart app already includes the iframeResizer.contentWindow scripts, so you only need to add it to your parent app.

Contributors guide

  1. Fork this repository (you can learn how to do this here).

  2. Clone the forked repository like so:

git clone https://github.com/<your username>/commercelayer-cart.git && cd commercelayer-cart
  1. First, install dependencies and run the development server:
pnpm install
pnpm dev
  1. (Optional) Set your environment with .env.local starting from .env.local.sample.

  2. Open http://localhost:3000 with your browser to see the result. You can use the following format to open the cart: http://localhost:3000/:orderId?accessToken=<your-access-token>

  3. Make your changes and create a pull request (learn how to do this).

  4. Someone will attend to your pull request and provide some feedback.

Need help?

  1. Join Commerce Layer's Slack community.

  2. Create an issue in this repository.

  3. Ping us on Twitter.

License

This repository is published under the MIT license.

commercelayer-cart's People

Contributors

clgiovannelli avatar dmantellassi avatar gciotola avatar malessani avatar semantic-release-bot avatar sfiorucci avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.