# SOLVED: Dynamic data: {woo\_product\_stock} issue Woocommerce products on back-order stock QTY display as positive integer

**URL:** <https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714>\
**Category:** Bugs\
**Tags:** v1-8-6\
**Created:** [August 18, 2023, 12:58pm UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714 "2023-08-18T12:58:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![audiovoyeur](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/audiovoyeur/32/8110_2.png) [@audiovoyeur](https://forum.bricksbuilder.io/u/audiovoyeur)\
**Post date:** [August 18, 2023, 12:58pm UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/1 "2023-08-18T12:58:50Z")

</div>

@devs - First of all thanks for awesome product - bricks rocks.

**Issue:**  
Using Woocommerce dynamic data {woo\_product\_stock:value} to display stock QTY - works as it should, BUT when stock is on “back order” ( where Woocommerce sees it as a negative number) it still displays as positive number.

or as @MatejMohar eloquently put it to me in the discord: _“As Bricks always returns absolute value, that’s why instead of -20 it returns 20. That way you can’t even have conditions to check if value is negative”_

 ![ScreenShot 2023-08-18 at 14.56.29](https://forum.bricksbuilder.io/uploads/default/original/2X/f/f83071a9c0c3c1b218fdeea3b74e731cec2f3862.png)

**Steps to recreate:**

- On fresh WP / Bricks / WooCommerce install set a product to have stock of 5
- set “allow back order” in products settings
- go to product, order 25 items, and checkout
- in back-end displays -20 products in stock - which is **correct**
- Front end displays 20 - which is **incorrect**

 ![ScreenShot 2023-08-18 at 10.03.42](https://forum.bricksbuilder.io/uploads/default/original/2X/e/e6b1f89f334c463f987e120fadb19d926e5ee94f.jpeg)  
 ![ScreenShot 2023-08-18 at 10.04.38](https://forum.bricksbuilder.io/uploads/default/original/2X/2/2a04ef2c294e8b3baa90b06e10888a342633d358.png)

---

<div class="post-metadata">

**Author:** ![aslotta](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/aslotta/32/5419_2.png) [@aslotta](https://forum.bricksbuilder.io/u/aslotta)\
**Post date:** [August 19, 2023, 7:38am UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/2 "2023-08-19T07:38:56Z")

</div>

Hey Pieter,

thanks a lot for your report.

As I’m not an e-commerce or WooCommerce expert I’m hearing of this backorder term for the first time. 😃 But yeah. In this case this sounds like a bug to me. However, I will leave this report on WAIT for now and get some feedback internally.

Best,

André

---

<div class="post-metadata">

**Author:** ![audiovoyeur](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/audiovoyeur/32/8110_2.png) [@audiovoyeur](https://forum.bricksbuilder.io/u/audiovoyeur)\
**Post date:** [August 19, 2023, 10:12am UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/3 "2023-08-19T10:12:21Z")

</div>

Thanks so much!

Same this side. I have not worked with WOO too much - we discovered it when clients demanded stock we don’t have 😃

I believe the absint() might be the issue there. as it forces the number positive (I think)

The other big question it what should it return when it is negative - maybe it should be something that can be fed into the dynamic data term something like

- {woo\_product\_stock:value:0} returns a 0 for negative stock value
- {woo\_product\_stock:value:No stock }" returns a “No stock” for negative stock value
- {woo\_product\_stock:value:On back order }" returns a “On back order” for negative stock value

Just a thought 🙂

---

<div class="post-metadata">

**Author:** ![aslotta](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/aslotta/32/5419_2.png) [@aslotta](https://forum.bricksbuilder.io/u/aslotta)\
**Post date:** [August 21, 2023, 7:35am UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/4 "2023-08-21T07:35:27Z")

</div>

Hey Pieter,

we agree that the `absint` solution isn’t ideal and will see how we can improve this.

Best,

André

---

<div class="post-metadata">

**Author:** ![audiovoyeur](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/audiovoyeur/32/8110_2.png) [@audiovoyeur](https://forum.bricksbuilder.io/u/audiovoyeur)\
**Post date:** [August 22, 2023, 6:18am UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/5 "2023-08-22T06:18:59Z")

</div>

Awesome Thanks!

Shout out to @matejmohar for pointing to the issue! 🙂

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [September 25, 2023, 12:55pm UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/6 "2023-09-25T12:55:10Z")

</div>

Hi Pieter,  
We’ve fixed this issue in Bricks 1.9.1/1.9.1.1, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,  
timmse

---

<div class="post-metadata">

**Author:** ![audiovoyeur](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/audiovoyeur/32/8110_2.png) [@audiovoyeur](https://forum.bricksbuilder.io/u/audiovoyeur)\
**Post date:** [September 25, 2023, 3:13pm UTC](https://forum.bricksbuilder.io/t/solved-dynamic-data-woo-product-stock-issue-woocommerce-products-on-back-order-stock-qty-display-as-positive-integer/14714/7 "2023-09-25T15:13:10Z")

</div>

Great News!  
Awesome! Thanks for the effort!  
Looking forward test it!
