SpreeCommerce Taxjar Extension Explained


Most of us are aware that in any kind of business, taxes need to be paid in one form or another. Taxes are regularized and controlled by different government bodies and at different levels like country, state, city or might be more granular level. Tax calculations have so many variables that proper adherence and compliance can be a daunting/time-consuming task for many businesses.

Online businesses adds to the complexity more as it increases the reach further to many locations.

To save time, hassle and proper compliance, there are many solutions from which you can choose like Taxjar, Avalara and Tax Cloud to name a few.Read more

Tackle Online Sales Tax using Taxjar

Online sales tax can be a maze.

Here is my list, after reading which, and with help from this amazing service called Taxjar, I hope a Store owner would be better armed to tackle this beast.

  1. Finding the Nexus where to collect taxes. Its better to consult the attorneys to be sure but can get a fair start and know how here
  2. Major components contributing to Sales Tax calculations:
    1. Nexus State is Origin or Destination Based
      1. E.g. Texas is Origin Based and California is Destination Based Nexus
    2. Nexus State charges tax on shipping or not
      1. E.g. Texas charges tax on shipping but not California
    3. Special Exemptions by state on certain product categories 1
    4. Sales Tax components by city, county, districts and different rules for same product
      1. Visit Taxjar Api Demo to see in action
  3. How does Taxjar take care of this complexity and help collect accurate taxes in their SmartCalc Apis
    1. SmartCalcs Api is a fancy name to the Taxjar Apis used for calculating sales tax and other supported apis as they Calculate sales tax Smartly
    2. Get the Api Token
    3. Add Nexus Addresses 2
    4. From the Nexus information, it automatically derives
      1. whether origin/destination based rules are applicable,
      2. whether shipping is taxable in nexus state or not
    5. To help with special tax calculations for different product categories, it needs more information in form of product tax codes
      1. Supported product tax categories are available through api and can be easily imported
      2. Product Tax categories need to be sent as part of line_item info
      3. Your development team can better decide whether to store tax codes in tax categories assigned to products or directly assigned to products or some other way as appropriate
    6. Taxjar also enables sending discount in line_items and handle the maths for you, for e.g. given a line_item having 2 quantity with unit_price 10 and discount of 5 correctly calculates taxable amount as 15 ((2 * 10) - 5)

Armed with the knowledge of the basics and with a the help of Taxjar, you can focus more on running the business and selling more without having to spend a lot of time on sales tax compliance

  1. Accurate and correct Nexus Information


  2. Detailed Analysis Report showing us the discrepancy between actual and expected sales tax


  3. Comparision of Orders vs Api requests affecting the Taxjar pricing
    1. Best Case scenario is 2 requests per order (1 for showing tax and another for recording order on taxjar)


We, at Vinsol, believe in partnering with our clients to offer them the most business friendly e-commerce solutions

And so we are in the process of upgrading our spreecommerce taxjar extension to cover most of the TaxJar integration functionality out-of-the-box. Stay tuned to learn more about how this open source extension can make the life of business owners a little easier.

Shopify Products/Orders/Customers Import in Spree

This blog post is continuation of our last blog post where we shared our experience of product import using datashift_spree. It explores the product & order import w.r.t Shopify.

As we already saw in our last blog post that datashift_spree lays the strong foundation for various product import cases, so we decided to rely and build on top of it for Shopify Product Import. Hence we wrote a simple transform to get datashift_spree_compatible csv to take Shopify Product Export CSV as input and return a CSV compatible with datashift product import. Yeah, you guessed it right, we adapted :)

Try the Product Import Demo here

  • Admin Credentials: pikender@vinsol.com/vinsol
  • Download Sample Shopify File or have yours ready :)
  • Ensure every product/variant has unique sku as needed by Spree
  • Product Import is a 2 step process
    1. Upload Shopify csv to get import compatible csv file
    2. Import the file generated, in Step 1, above to populate products

We did not got lucky with Shopify Order Import like our product import so we sat to create instead of adapt this time and changes can be reviewed here

Please note that above Order Import is not exhaustive and is developed keeping in mind that we are interested in showing customer's their order history so might not correctly work for cases where order processing details & sequence are important.

Try the Order Import Demo here

  • Admin Credentials: pikender@vinsol.com/vinsol
  • Line items product/variant lookup is based on sku's
    • Upload the Shopify Product CSV to ensure all line item sku's/products are already present, OR,
    • Check the product sku's in line items are present in existing products, otherwise it will fail while checking product/variants
  • Download Sample Orders CSV or have yours ready :)
  • Import the downloaded file to load order history

Last, but not the least, we completed the Shopify system migration with
customers. Shopify Customer's Export CSV will work without changes and
address imported as Ship Address by default but can be imported as Bill
Address with configuration.

Try the User Import Demo here

  • Admin Credentials: pikender@vinsol.com/vinsol
  • User & Address import can be easily configured as Ship/Bill Address
  • It creates the user, if needed
  • It creates the addresses only if not already associated with user,
    else skips it

Please share the feedback and report any issues, you may find while trying out the imports by raising issues on respective github repos

Need help migrating Shopify Stores to Spree for more control
and customisation or to discuss, reach out to us

We are always trying to meet Business time-to-market requirement with the technical challenges and bridge the gap to be narrower :)

Checkout Launch Your Store in One Day to not miss the edge.

My experience with Spree Commerce Product Import using Datashift Spree


Recently we worked on re-platforming an E-commerce store that we wanted to move to SpreeCommerce to expand their offering & to cater to existing customers better.

As we analysed their ambitious requirements and the desire to launch in a very short period of time, we evaluated existing Spree Commerce extensions that we could use to get work done in the shortest possible period of time.

One big task in the migration, was moving over their existing product catalog to SpreeCommerce.

Our search for an already proven solution for this led us to datashift_spree which looked very promising. datashiftspree is a part of datashift which is a set of tools which help import and export from generic Ruby on Rails application. Datashift has very well defined conventions across representation of data in various cases.

The Run


As we started evaluating datashift_spree for the capabilities it mentions, we started seeing some roadblocks as with any integration. Thankfully the roadblaocks were code-critical which we are most comfortable dealing with :)

Just to mention few:

Spree Product Import Usecases

  • Dummy Run helps to find & fix errors without corrupting database with invalid values
  • In case of errors, a detailed report of what/when/how related to steps execution is invaluable for the developer and operations guy for the confidence in import process and its correctness.
  • A uniform convention for data representation catering to different usecases makes the api/changes intuitive for not documented cases and help extend with minimum effort.

Dev Setup with updated branches on Github forks

Product Import with No Variants

  • After setting up datashift_spree and Spree store locally using Dev Setup with updated branches on Github forks
  • You get access to the enhanced capabilities as exposed in commandline
  • CSV Format
    • Add the product attributes like sku, price, name, description, available_on, cost_price, shipping_category
    • A special column name "Images" will help you add images to product
    • You can provide both a local path accessible while import or an image url
  • Import Command
    • RAILS_ENV=datashift bundle exec thor datashift_spree:load:products -v -i /path/to/csv_file
    • Don't forget to change RAILS_ENV as applicable and check the path to csv file
  • Output
    • Consolidated Report of CSV rows to be processed, stored in database, with errors and high level errors for failed records
    • Detailed Processing log can be referred in Rails log file

Product Import with Variants and Product Attributes Default in Variants

  • CSV Format
    • Product Attibutes as mentioned in above case should be present and to make variants, we need to define option_type/option_values as applicable to variant
    • Add variants column in csv and define variants as explained here
  • Import Command
    • No change in import command :)
    • RAILS_ENV=datashift bundle exec thor datashift_spree:load:products -v -i /path/to/csv_file
  • Output
    • Consolidated Report of CSV rows to be processed, stored in database, with errors and high level errors for failed records
    • Detailed Processing log can be referred in Rails log file which will show creation of variants along with product and master both

Product Import with Variants and overriding Product Attributes Default in Variants

  • CSV Format
    • Variants attributes can be override using special csv columns as supported by datashift_spree which are self-explanatory
    • "variant_sku","variant_cost_price","variant_price","variant_images","stock_items
    • It requires to match number of variants to be exactly same as the overriding values above
    • If there are 5 variants to be created, each column above should provide 5 values separated by |
  • Import Command
    • No change in import command :)
    • RAILS_ENV=datashift bundle exec thor datashift_spree:load:products -v -i /path/to/csv_file
  • Output
    • Consolidated Report of CSV rows to be processed, stored in database, with errors and high level errors for failed records
    • Detailed Processing log can be referred in Rails log file

Further Enhancements

  • Product Import from Shopify Export CSV
  • Upgrade datashift_spree to be compatible with latest datashift version
  • Spree Order Import from CSV

We are always trying to meet Business time-to-market requirement with the technical challenges and bridge the gap to be narrower and narrower :)

Checkout Launch Your Store in One Day to not miss the edge.


Phoenix View Extension

The post belongs to NectarCommerce and Extension Framework Awareness Series

  1. NectarCommerce Vision
  2. Extension Framework Game Plan
  3. Introduction to Metaprogramming
  4. Ecto Model Schema Extension
  5. Ecto Model Support Functions Extension
  6. Phoenix Router Extension
  7. Phoenix View Extension
  8. Running Multiple Elixir Apps Together
  9. Extension Approach Explained
  10. Learning from failures: First Experiment at NectarCommerce Extension Approach
  11. Developing NectarCommerce Extensions
  12. Building an exrm release including NectarCommerce

What will be NectarCommerce

Off-the-shelf Opensource E-commerce application for building an online store.

Provides an Extension Framework to support features not included in core as extensions.

Strives for unobtrusive parallel development of NectarCommerce and Extensions

NectarCommerce is committed to providing a ready-to-use e-commerce solution but the definition of 100% is different under different business domains. It aims to solve common use-cases as part of the project and relying on extension framework to tap the rest.

Phoenix View Extension


We want to allow Extensions to provide alternate view for an existing view in Nectar or provide an alternate template path for all views without changing the Nectar Views.


Note: Please refer Introduction to Metaprogramming for more information on Metaprogramming in Elixir

Alternate View Templates Path than Default for all templates override

To fully understand the changes below, please refer Phoenix View Implementation

As per the reference above, we simply defined a function which adds the ability to check custom path for templates and if not found will fallback to default view paths :)

Only Few Template Overrides than all

Note: This section would be very similar to Ecto Model Support Functions Extension, so only complete code-snippets are shown and not incremental walkthrough

Check the library code, service code and consumer code as used with Nectar Wallet Extension

Library Code

Service Code

Consumer Code

Partial Override from Extension

Our aim with these posts is to start a dialog with the Elixir community on validity and technical soundness of our approach. We would really appreciate your feedback and reviews, and any ideas/suggestions/pull requests for improvements to our current implementation or entirely different and better way to do things to achieve the goals we have set out for NectarCommerce.

Enjoy the Elixir potion !!

Privacy Preference Center