Installation

  1. Add this extension to your Gemfile with this line:
  gem 'spree_printful', github: 'lemuelbarango/spree_printful'
  1. Install the gem using Bundler:
    ruby
    bundle install

  2. Copy & run migrations
    ruby
    bundle exec rails g spree_printful:install

  3. Restart your server

If your server was running, restart it so that it can find the assets properly.

Heroku installation

Additional to migrations the gem adds a cron task (via the Whenever gem) which is needed for updating product stocks. To run on Heroku you have to add a task to Heroku Scheduler:

rake spree_braintree_vzero:update_states

Recommended frequency is every hour.

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories.
Simply add this require statement to your spec_helper:

require 'spree_printful/factories'

Setup

Once you have a Printful account and a printful api-key, you can go to the Printful Settings admin configuration screen to set the api key.

If you want your orders to be sent directly to printful, add a printful_variant_id and a printfile image to all your products variants

NOTE: When working with printfiles, make sure that images are not hosted on localhost. Also check that the absolute url is returned for the printfiles

TODO

  • [x] Sync product stocks with printful
  • [ ] Integrate with Printful Webhooks to shipping, etc
  • [ ] Orders are currently submitted as draft, add setting to skip draft
  • [ ] Add option for multiple printfiles
  • [ ] Currently supports products with multiple variants. Fix this to support products with no variants
  • [ ] Add hadling fee to Shipping calculator

Contribution

Pull requests are welcome, along with any feedback or ideas.

License

MIT

Comments

No comments yet

Please login to add comment.