GithubHelp home page GithubHelp logo

Comments (8)

minasmart avatar minasmart commented on June 15, 2024

A couple things: Are you planning on managing cart associations to users yourself? If you're not, use fetchRecentCart. Also, if you console.error(error) the error that's sent to catch, can you post the trace?

from js-buy-sdk.

kevinzaki avatar kevinzaki commented on June 15, 2024

I do plan on managing cart associations. Basically my plan is to use the buy SDK to generate and manage carts for products stored on Shopify. Once I have a completed cart I am going to use the regular API to create an order and process payments separately. The error I am getting is the following:

[ReferenceError: localStorage is not defined]

from js-buy-sdk.

minasmart avatar minasmart commented on June 15, 2024

What environment are you running this in? Node or browser?

from js-buy-sdk.

kevinzaki avatar kevinzaki commented on June 15, 2024

Node, running my server using Gulp locally at the moment.

from js-buy-sdk.

minasmart avatar minasmart commented on June 15, 2024

Ah... OK. Yeah. This is a thing we failed to implement.

For the time being, somewhere in your startup code, if you did something like

global.localStorage = {
  _storage: {},
  setItem: function(key, value) {
    this._storage[key] = value;
  },
  getItem: function(key) {
    return this._storage[key]
  },
  clear: function() {
    this._storage = {};
  }
};

I understand this is ugly, but it'll get you by for now. I'll post here when we make this functionality work properly in node.

from js-buy-sdk.

kevinzaki avatar kevinzaki commented on June 15, 2024

Thanks it worked, wouldn't of figured that out without some help.

from js-buy-sdk.

muzuitech avatar muzuitech commented on June 15, 2024

How can I set up background colors and other stuffs using createCart() ? Anyone have idea. I am researching but not able to find anything which can solve.

Here is the code :

ui.createCart({ "styles": { "button": { "background-color": "#cccccc", "font-family": "Raleway, sans-serif", "font-size": "18px", "padding-top": "17px", "padding-bottom": "17px", ":hover": { "background-color": "#cccccc" }, ":focus": { "background-color": "#cccccc" }, "font-weight": "normal" }, "footer": { "background-color": "#cccccc" } }, "googleFonts": [ "Raleway" ] });

Thanks

from js-buy-sdk.

rebeccajfriedman avatar rebeccajfriedman commented on June 15, 2024

@muzuitech Can you please create a new issue for this in the https://github.com/Shopify/buy-button-js repo?

from js-buy-sdk.

Related Issues (20)

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.