I have a PHP function, which is properly signed. It returns the result of a simple calculation.
In my woocommerce product query loop I am calling this function via {echo} and passing a string (the product price), in a basic text element, like this:
{echo:get_retail_price({woo_product_price})}
The problem is that on the front end, this is rendered as {echo:get_retail_price({woo_product_price})} (verbatim).
I tried replacing the nested dynamic data {woo_product_price} with the same value used for the first product in the loop: â$100.00â. On the front end it appeared as {echo:get_retail_price(â$100.00â)}.
Then I tried removing the $ symbol, and it worked: {echo:get_retail_price(â100.00â)}.
The bug then is that the echo function doesnât seem to work if a parameter contains a dollar sign. Is there any workaround for this?
Iâm not sure you can do a nested dynamic tag here, regardless of the dollar sign.
But even if you can, the {woo_product_price} variable apparently returns HTML, not just the number with a dollar sign. Chances are whatever itâs returning canât be sent to the function as-is.
In your case, the plain number would be {woo_product_regular_price:value}. But again, not sure if you can embed that into the echo function.
Another thing to try is to surround the inner tag with its own quote, to encapsulate the string, like echo:func( â {wooâŠ} â )
Again Iâm not sure if adding the single quotes will help at all.
Boom! Adding â:valueâ works! Thank you so much!
How did you know that {woo_product_price} returns HTML? Is there some documentation somewhere that shows shat each dynamic tag returns and itâs format? Knowing this could have saved me so much time.