# Use woocommerce rest api

**URL:** https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906
**Category:** Feature Request
**Created:** [September 6, 2022, 5:52pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906 "2022-09-06T17:52:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Pinegrow\_Learner](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pinegrow\_Learner](https://forum.pinegrow.com/u/Pinegrow_Learner)
#### Post date: [September 6, 2022, 5:52pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/1 "2022-09-06T17:52:50Z")

</div>

Hi,

I have heard the REST API based Woocommerce features are more performant than traditional woo approach. [Introduction – WooCommerce REST API Documentation - WP REST API v3](https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction)

Cwicly builder is working to implement on them. What do you think @matjaz ?

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [September 8, 2022, 10:37pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/2 "2022-09-08T22:37:22Z")

</div>

Customizing WC is a pain because of the mix of data, layout and styling in templates and WC template functions. Dealing with API circumvents that by working only with data. But that creates a solution that is not compatible with the WC ecosystem of plugins and themes.

Not sure about performance - constructing a product list view or a shop landing page would require many API calls, with each API call loading WP, WC and fetching db data. When this happens in a normal PHP page view, this happens only once. That’s just my thinking, without measuring anything.

I think, as it is, PGWC gives a good compromise between using the official WC approach and giving flexibility.

---

<div class="post-metadata">

### Author: ![Pinegrow\_Learner](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pinegrow\_Learner](https://forum.pinegrow.com/u/Pinegrow_Learner)
#### Post date: [September 12, 2022, 5:52am UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/3 "2022-09-12T05:52:34Z")

</div>

@matjaz Thanks for the detailed answer. I wanted to know what areas I need to use jquery with Pinegrow woo elements. I am not loading jquery on the cart and checkout page as I use the gutenberg woo official blocks which have no dependency for the same. I will use PG woo elements on the rest of the pages (product loop, single product). So will I need jquery on those pages? I don’t use the default woo photo gallery as we have a different custom field for photos and gallery.

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [September 12, 2022, 2:05pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/4 "2022-09-12T14:05:01Z")

</div>

@Pinegrow_Learner

> [@Pinegrow\_Learner](#):
>
> I don’t use the default woo photo gallery as we have a different custom field for photos and gallery.

In this case you will only have to use jQuery on Single Product because WC scripts use it to power Add to cart functionality.

---

<div class="post-metadata">

### Author: ![Pinegrow\_Learner](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pinegrow\_Learner](https://forum.pinegrow.com/u/Pinegrow_Learner)
#### Post date: [September 20, 2022, 2:21pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/5 "2022-09-20T14:21:39Z")

</div>

Thanks @matjaz. Everything is working fine and smooth. I am also looking for a way to use custom cpt (non woo) to add products to woo cart. They have a price custom field. I tried a few solutions but they turned out messy and didn’t work well. Do let me know if you know any way to achieve this.

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [September 22, 2022, 8:05pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/6 "2022-09-22T20:05:02Z")

</div>

> [@Pinegrow\_Learner](#):
>
> I am also looking for a way to use custom cpt (non woo) to add products to woo cart.

@Pinegrow_Learner sorry, I don’t have any experience with this. So you want to add custom CPT into the Woo cart? Is that possible?

---

<div class="post-metadata">

### Author: ![Pinegrow\_Learner](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pinegrow\_Learner](https://forum.pinegrow.com/u/Pinegrow_Learner)
#### Post date: [September 23, 2022, 4:30am UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/7 "2022-09-23T04:30:32Z")

</div>

@matjaz Yes. That’s what I want to do. It is possible but need to keep up with woo changes. [php - woocommerce add custom post type to cart - Stack Overflow](https://stackoverflow.com/questions/40732683/woocommerce-add-custom-post-type-to-cart)

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [September 23, 2022, 5:06pm UTC](https://forum.pinegrow.com/t/use-woocommerce-rest-api/6906/8 "2022-09-23T17:06:56Z")

</div>

@Pinegrow_Learner the solution looks like a hack, it would be super hard to maintain compatibility with WC. My take is that WC is not built to be used with non-product post types. There are many checks for “product” === post-\>post\_type in the WC code.

It would be better to extend the Product post type with the features you need, instead of getting WC to work with CPT.
