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

Starward WooCommerce

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

★ 2stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/birdbrain/starward-woocommerce-plugin/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

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