Giter Site home page Giter Site logo

woocommerce-json-api's Introduction

WooCommerce JSON API

You cannot test this code while logged into Wordpress. You will need to log out of wordpress, or open a new incognito window to test the code.

A simple, Abstract JSON API for Wordpress' Awesome Plugin: WooCommerce

Here is an example, using jQuery

    var url = 'http://woo.localhost/c6db13944977ac5f7a8305bbfb06fd6a/?callback=?';
    params = { action: 'woocommerce_json_api', proc:"get_products"};
    params.arguments = {token: 1234, per_page: 10, page: 1}
    jQuery.getJSON(url,params).done(function (data) { console.log(data);});

And here would be the response, trimmed down a bit:

    jQuery171020958687388338149_1373358917457({
        "callback": "jQuery171020958687388338149_1373358917457",
        "action": "woocommerce_json_api",
        "proc": "get_products",
        "arguments": {
            "token": "1234",
            "per_page": "10",
            "page": "1"
        },
        "_": "1373358924670",
        "status": true,
        "errors": [

        ],
        "warnings": [

        ],
        "notifications": [

        ],
        "payload": [
            {
                "id": "1461",
                "name": "Api created product 14",
                "slug": "",
                "type": "product",
                "description": "",
                "status": "",
                "sku": "A349",
                "downloadable": "",
                "virtual": "",
                "manage_stock": "",
                "sold_individually": "",
                "featured": "",
                "allow_backorders": "",
                "quantity": 0,
                "height": "",
                "weight": "",
                "length": "",
                "price": "15.95",
                "regular_price": "15.95",
                "sale_price": "",
                "sale_from": "",
                "sale_to": "",
                "attributes": "",
                "tax_class": "",
                "tax_status": "",
                "categories": [

                ],
                "tags": [

                ],
                "featured_image": false
            },
            ...
            {
                "id": "1279",
                "name": "Bodum Brazil Coffee Press 8 Cup",
                "slug": "bodum-brazil-coffee-press-8-cup",
                "type": "product",
                "description": "<p>Pellentesque habitant morbi ...<\/p>",
                "status": "instock",
                "sku": "W027",
                "downloadable": "no",
                "virtual": "no",
                "manage_stock": "no",
                "sold_individually": "",
                "featured": "no",
                "allow_backorders": "no",
                "quantity": 0,
                "height": "",
                "weight": "",
                "length": "",
                "price": "43",
                "regular_price": "43",
                "sale_price": "",
                "sale_from": "",
                "sale_to": "",
                "attributes": "",
                "tax_class": "",
                "tax_status": "taxable",
                "categories": [
                    {
                        "id": "26",
                        "name": "Coffee &amp; Tea",
                        "slug": "coffee-tea",
                        "description": "",
                        "parent_id": "0",
                        "count": "4",
                        "group_id": "0",
                        "taxonomy_id": "28"
                    },
                    {
                        "id": "41",
                        "name": "Coffee Plungers",
                        "slug": "coffee-plungers",
                        "description": "",
                        "parent_id": "26",
                        "count": "1",
                        "group_id": "0",
                        "taxonomy_id": "43"
                    }
                ],
                "tags": [

                ],
                "featured_image": "http:\/\/woo.localhost\/wp-content\/uploads\/2012\/12\/Bodum-Coffee-Press-1.jpg"
            },
            ...
        ],
        "payload_length": 10
    });

How to install

cd into your wp-content/plugins directory and clone the repo

git clone git://github.com/jasonknight/woocommerce-json-api.git

How to update

cd into your wp-content/plugins/woocommerce-json-api directory and run:

git pull

Visit the Wiki for more Documentation

TODO

woocommerce-json-api's People

Watchers

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