headless-wc-client
v1.0.5
Published
WooCommerce Headless Solution
Downloads
6
Maintainers
Readme
Headless WooCommerce Client
Client for Headless WooCommerce Wordpress Plugin
Installation
- Install HeadlessWC: Ultimate eCommerce Decoupler WordPress plugin on your site
- Install this package
npm install headless-wc-client
- Done!
Examples
- Geting all WooCommerce products in React
const headlessWC = new HeadlessWC("https://example-wc-site.com");
const products = await headlessWC.getProducts();
return (
<>
{products.map((product) => (
<div>
<img src={product.image.full} alt="" />
<h3>Name: {product.name}</h3>
<p>Price: {product.price}</p>
<h4>Short description:</h4>
<div dangerouslySetInnerHTML={{ __html: product.short_description.rendered }} />
</div>
))}
</>
);