WP Manifestindependent plugin directory
manifest / ecommerce / starward-woocommerce-plugin

Starward WooCommerce

This plugin creates custom API endpoints and extends existing WooCommerce REST API responses

by BirdBrain · github.com/birdbrain/starward-woocommerce-plugin · website

2stars
2forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/birdbrain/starward-woocommerce-plugin/archive/refs/heads/master.zip

Readme

Starward WooCommerce Plugin

Custom Endpoints

HTTP GET: ${WP_URL}/wp-json/starward/products/filters/category/${categoryId}
  • Gets product filters for a specific category specified by its ID

Extending Existing Functions

filter_product_category_multiple_attributes
  • Extends the WooCommerce query for products in class-wc-rest-products-controller.php
  • Allows for filtering by multiple attributes by their slug
  • E.g. http://localhost:3000/store/living?pa_size=28&pa_color=23
filter_woocommerce_rest_prepare_product_object
  • Extends the WooCommerce single product response

WP Functions

get_term_meta
  • Grabs meta data from the WP database
  • Used to get swatch hex values when extending the product response
get_terms
  • Gets all attribute terms belonging to the attribute specified by its taxonomy (i.e. pa_color, pa_size...)
wc_get_attribute_taxonomies
  • Gets all product attributes (name, label, id...)
wc_get_attribute_taxonomy_names
  • Returns an array of attribute taxonomies (i.e. [pa_color, pa_size...])
wc_get_product
  • Returns a product object

Read the full README on GitHub →