Resource product stock levels

Hi, I have a question regarding updating stock levels with commerce.

I have a resource product with a stock level tv setup. I’ve enabled the update and enforce stock modules in commerce.

When the resource product is purchased the stock level tv is updated automatically in the modx resource page, without clearing the cache, as expected. However in my template I am showing the tv un-cached like [[!*prodStock]] but it is not updated. If I clear the cache it updates.

Any ideas why that is and how I can show un-cached stock levels?

The resource cache includes TV values so that’s going to be extra sticky - even when uncaching the tag. Theoretically Commerce could wipe that cache, however that may not be ideal performance wise.

Try asking Commerce for the stock instead:

[[!commerce.get_product? &products=`[[commerce.get_resource_product_id]]` &field=`stock`]]

Thanks mark, I got around it using pdoField in the end

1 Like