Skip to content

Utility script to transform woo-commerce export data for a hugo site

Notifications You must be signed in to change notification settings

bhirons/woocommerce-csv-to-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

woocommerce-csv-to-hugo-md-files

Purpose

To aid the re-implement of a Wordpress/WooCommerce storefront into a jamstack-ey static site built using Hugo and editable in Forestry for content editors-- this script picks up a attributes from a CSV file exported from the default WooCommere Export button and saves them as hugo style md files with front matter yaml at the top of the output file, and any content at the bottom.

Another purpose is to have a simple procedural script that changes with the task at hand.

The output can be dropped directly into the working tree bound for serving content editors in Forestry or Cloudcannon, for example.

This repo forked from csv-to-hugo-md-files cause it was a good boilerplate to get started.

Usage

  • Export your products from WooCommerce using the export button on the Products page
  • Clone this repository
  • npm i
  • Move your exported .csv file(s) into the csv-file folder
  • node .\converter.js
  • Look at results in resulting-md-files

Behavior

Behavior is specific to my own requirements, all of this is easily modified. Suggest you fork this repo and go to town ;)

  • output file name is slugify-ed from product name
  • images paths are flattened
  • duplicates of a given product-name will be named product-name-2, product-name-3, etc
  • script only processes simple or variable products and checks for type when parsing
  • script cleans and trims various text artifacts found in export data
  • captures categories and tags

About

Utility script to transform woo-commerce export data for a hugo site

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published