adeleyeayodeji / ade-woocart

ade woocommerce cart api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ade-woocart

Description

This plugin helps you to create a cart for your WooCommerce store through API.

Installation

  1. Upload the plugin files to the /wp-content/plugins/ade-woocart directory, or install the plugin through the WordPress plugins screen directly.

  2. Activate the plugin through the 'Plugins' screen in WordPress

  3. Use the Settings->Ade Woocart screen to configure the plugin

Frequently Asked Questions

How to use this plugin?

  1. Add a cart

    • Endpoint: http://yourdomain.com/wp-json/ade-woocart/v1/cart?username=wordpress
    • Method: POST
    • Body:
    {
      "product_id": 248,
      "quantity": 3
    }
    • Response:
    {
      "message": "Item added to cart",
      "status": "success",
      "data": {
        "product_id": 14,
        "quantity": 7,
        "username": "wordpress"
      }
    }
  2. Get cart

    • Endpoint: http://localhost:8888/wordpress/wp-json/ade-woocart/v1/cart?username=wordpress
    • Method: GET
    • Response:
    {
      "username": "wordpress",
      "message": "Cart items",
      "data": "::1",
      "time": "2023-11-28 08:56:43",
      "cart_count": 3,
      "cart_items": [
        {
          "key": "70efdf2ec9b086079795c442636b55fb",
          "product_id": 17,
          "product_name": "Product 3",
          "product_price": "700",
          "product_image": "http://localhost:8888/wordpress/wp-content/uploads/2023/11/c-d-x-PDX_a_82obo-unsplash-scaled-1-150x150.jpg",
          "quantity": 3
        },
        {
          "key": "9bf31c7ff062936a96d3c8bd1f8f2ff3",
          "product_id": 15,
          "product_name": "Product 2",
          "product_price": "1500",
          "product_image": "http://localhost:8888/wordpress/wp-content/uploads/2023/11/eniko-kis-KsLPTsYaqIQ-unsplash-scaled-1-150x150.jpg",
          "quantity": 1
        },
        {
          "key": "aab3238922bcc25a6f606eb525ffdc56",
          "product_id": 14,
          "product_name": "Product 1",
          "product_price": "1000",
          "product_image": "http://localhost:8888/wordpress/wp-content/uploads/2023/11/photo-1523901839036-a3030662f220-150x150.webp",
          "quantity": 1
        }
      ]
    }
  3. Remove from cart

    • Endpoint: http://localhost:8888/wordpress/wp-json/ade-woocart/v1/cart/delete?username=wordpress
    • Method: POST
    • Body:
    {
      "product_id": 17
    }
    • Response:
    {
      "message": "Item removed",
      "status": "success",
      "data": {
        "product_id": 17,
        "username": "wordpress"
      }
    }
  4. Update a cart

    • Endpoint: http://localhost:8888/wordpress/wp-json/ade-woocart/v1/cart/update?username=wordpress
    • Method: POST
    • Body:
    {
      "product_id": 14,
      "quantity": 7
    }
    • Response:
    {
      "message": "Item updated",
      "status": "success",
      "data": {
        "product_id": 14,
        "quantity": 1,
        "username": "wordpress"
      }
    }
  5. Remove all cart items

    • Endpoint: http://localhost:8888/wordpress/wp-json/ade-woocart/v1/cart/delete/all?username=wordpress
    • Method: POST
    • Response:
    {
      "message": "Cart emptied",
      "status": "success",
      "data": {
        "username": "wordpress"
      }
    }

About

ade woocommerce cart api


Languages

Language:PHP 100.0%