Skip to content

A WordPress snippet to export all WooCommerce products in JSON format. The script enables administrators to download a `products.json` file containing product details such as ID, name, price, SKU, description, stock, categories, tags, and image URLs.

Notifications You must be signed in to change notification settings

winston9310/WooCommerce-Product-Exporter-JSON-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

WooCommerce Product Exporter (JSON)

A WordPress snippet to export all WooCommerce products in JSON format. The script enables admins to download a products.json file containing product details such as ID, name, price, SKU, description, stock, categories, tags, and image URLs.

Features

  • Exports all WooCommerce products in a single JSON file.
  • Includes essential product details:
    • Product ID
    • Name
    • Price
    • SKU
    • Description
    • Stock quantity
    • Categories
    • Tags
    • Product image URL
  • Restricted access to administrators only for security.

Installation

  1. Add the PHP snippet to your WordPress theme's functions.php file (also can create your own plugin).

Usage

To export products, visit your website with the following URL while logged in as an administrator: https://yourcoolwebsite.com/?export_products=json

This will trigger a download of a file named products.json.

JSON Format Example

The exported JSON file will look like this:

[
    {
        "id": 1,
        "name": "Sample Product",
        "price": "29.99",
        "sku": "SKU123",
        "description": "This is a sample product description.",
        "stock": 10,
        "categories": ["Category 1", "Category 2"],
        "tags": ["Tag 1", "Tag 2"],
        "image": "https://yourwebsite.com/wp-content/uploads/2024/01/sample.jpg"
    }
]

About

A WordPress snippet to export all WooCommerce products in JSON format. The script enables administrators to download a `products.json` file containing product details such as ID, name, price, SKU, description, stock, categories, tags, and image URLs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages