Skip to content

This update on Shopify BuyButton.js adds support and instructions for custom attributes with your buy button.

License

Notifications You must be signed in to change notification settings

Innovation-Magic-LLC/buy-button-js-customattributes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BuyButton.js with custom attributes

~ For custom engineering solutions, please contact our firm get-magic.com ~

This repository contains a modified version of the Shopify Buy Button library that allows developers to add custom attributes to product line items. While the default Buy Button library does not support this functionality, our implementation enables sending additional data from external applications to Shopify, facilitating the creation of custom retail functionality.

Features

  • Add custom attributes to product line items during checkout
  • Attributes are visible to customers during the checkout process
  • Attributes are accessible in the Shopify admin panel and through webhooks as metadata

Limitations

  • Custom attributes are not displayed in the cart before checkout, which may cause confusion for customers with bulk orders. However, this should not be an issue for small orders.
  • mocha test framework is purged
  • After compiling the library, you will need to manually merge your bits with the live shopify bits. We have provided our compiled minified version in ./latest folder.

Usage

This project is shared for educational purposes and is provided without warranty under the MIT license.

Use and self-host at your own risk.

To build and run the project, we recommend using a Linux environment.

Notes

For reference, we keep a copy of the code we compiled before and after merging it.

/dist-compiled/[date]/github-dist - this is the original github compiled dist /dist-compiled/[date]/customattributes-dist - this is the updated code compiled dist /dist-compiled/[date]/shopify-live - this is a reference copy of the live library hosted by shopify /dist-compiled/[date]/release - this is the minified source

/latest - this is the latest minified source with custom attribute functionality.

Prereqs :

  1. Install nvm
  2. Install build essentials and python 2 sudo apt-get install -y build-essential g++ python2
  3. Set project to use NodeJS 15 nvm use 15
  4. Install yarn npm install yarn -g
  5. Remove from package.json file 'wdio-mocha-framework' which contains the unsupported npm 'fibers' dependency. Its used for test automation.
  6. Run yarn install
  7. Run yarn build

Happy building!!!

Original unmodified Readme:

BuyButton.js

BuyButton.js on NPM Travis

BuyButton.js is a highly customizable UI library for adding ecommerce functionality to any website. It allows you to create interactive UI components such as product listings and shopping carts with minimal configuration, while allowing you to easily customize the appearance and behaviour of the components. It uses the JS Buy SDK to connect to your Shopify store, giving you access to your products and collections.

To get started, take a look at the documentation. For questions, suggestions and feeback, please create an issue.

Development

yarn
cp index.example.html index.html
  • Add your API key and shop domain to index.html
  • Set a product ID in index.html
yarn run start

Will watch for changes, compile src/ to tmp/ using babel & browserify, and run a server on port 8080.

Testing

yarn run test

will run full test suite locally

yarn run test-dev

Will watch for changes and run test suite.

Documentation

To run docs locally, install jekyll:

gem install jekyll
yarn run docs

Doc server will run at http://localhost:4000/buy-button-js/ Docs source files are located in /docs. Docs are automatically deployed to gh-pages from master.

About

This update on Shopify BuyButton.js adds support and instructions for custom attributes with your buy button.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.1%
  • CSS 2.9%