Coder Social home page Coder Social logo

iq-scm / woocommerce2vuestorefront Goto Github PK

View Code? Open in Web Editor NEW

This project forked from divanteltd/woocommerce2vuestorefront

0.0 0.0 0.0 22 KB

This is WooCommerce to Vue Storefront data bridge. Harness the power of Progressive Web Apps for Your Woo Commerce shop!

Home Page: https://vuestorefront.io

JavaScript 100.00%

woocommerce2vuestorefront's Introduction

Introduction

woocommerce2vuestorefront indexer is standalone application designed to feed VSF's catalog models with data right from WooCommerce.

Vue Storefront demo

See how it works! Sign up for a demo at https://vuestorefront.io/ (Vue Storefront integrated with Pimcore, Magento2, WooCommerce ...).

You should install Vue Storefront prior to use this indexer (which is feeding the Vue Storefront datbase). Read the installation guide.

WooCommerce indexer

This project provides an indexer for WooCommerce data structures

The module is a standalone application that:

  • does process and index: attributes, products and categories to Elasticsearch Search Engine (VSF Catalog model)

Setup and installation

Requirements

  • Node.js 8.2 or higher
  • Running Elasticsearch 5.6+ (It's contained in whole VSF API stack)
  • Running WooCommerce (tested on version 3.5.3)

Pre-configuration on WooCommerce side

  1. Make sure you have configured REST API properly, and the REST API is publicly accessible
  2. Generate consumer key and consumer secret in advanced tab in WooCommerce settings (read only permissions are sufficient)
  3. Having already installed VSF API, you should build an index with proper mapping for each type, you can achive this by running at the VSF API project's root dir: nodejs scripts/db.js new

Configure WooCommerce REST API connection

In config.js there is a woo section when you should adjust some data, i.e. keys for REST requests:

woo: {
    api: {
      host: 'localhost',
      protocol: 'http',
      auth: {
        consumer_key: "",
        consumer_secret: "",
        version: "v3"
      }
    }
  },

notice that version should stay the same.

Configure Elasticsearch connection

In db section contained in config.js file you should adjust some info about ES:

  db: {
    host: 'localhost',
    port: 9200,
    driver: 'elasticsearch',
    url: 'http://localhost:9200',
    indexName: 'vue_storefront_catalog'
  },

notice that indexName can be changed but it should stay consistent with VSF configuration.

Populate WooCommerce data in Elasticsearch

Run indexers

Please execute indexers one by one with:

  1. attributes: nodejs cli.js attributes
  2. categories: nodejs cli.js categories
  3. products: nodejs cli.js products

and that's it.

For developers

additional requirements

  • docker
  • docker-compose

Run Wordpress with WooCommerce included (dockerized)

To simplify the development process You may want to use one of existing tools, for instance: ready-to-use docker images and wp-cli:

  1. run containers by using docker-compose.dev.yml located in dev/docker/ subdirectory: docker-compose -f docker-compose.dev.yml up

it's recommended to run this command being inside docker dir, because of docker's networking naming conventions which will be used in further steps

  1. install Wordpress fresh instance: docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp core install --url="localhost" --title="VSFvsWoo" --admin_user="admin" --admin_email="[email protected]" --admin_password=admin

notice what parameters should be passed with command above: network and volumes-from should cover names set in docker-compose.dev.yml it creates a new wordpress's instance available on localhost and with credentials admin/admin

  1. install woocommerce plugin via wp-cli: docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp plugin install woocommerce --activate

  2. add some attributes and options, running:

   docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp wc product_attribute create --name=Size --type=options --user=admin
   docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp wc product_attribute_term create 1 --name=XS --user=admin
   docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp wc product_attribute_term create 1 --name=L --user=admin

wp-cli command wc product_attribute_term create requires as a first input an ID of attribute created at first step (in this case 1)

  1. add some products via cli or manually in wp-admin panel:
docker run -it --rm --volumes-from vsf_woo --network docker_default wordpress:cli wp wc product create --name="Vue T-Shirt L" --type=simple --sku=VUE/T-shirt/L --regular_price=200 --user=admin --sale_price=150 --stock_quantity=94 --in_stock=true

always pay attention to the arguments provided in commands above which can vary depending on WP/WooCommerce current state.

Credits

This module has been initially created by Divante's team:

  • Maciej Kucmus - @mkucmus

Support

If You have any questions regarding this project feel free to contact us:

Licence

woocommerce2vuestorefront source code is completely free and released under the MIT License.

woocommerce2vuestorefront's People

Contributors

antonilchuk avatar pkarw 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.