{"id":9289657,"date":"2017-07-05T06:35:34","date_gmt":"2017-07-05T06:35:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/get-price-via-ajax\/"},"modified":"2017-07-05T06:35:34","modified_gmt":"2017-07-05T06:35:34","slug":"get-price-via-ajax","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/get-price-via-ajax\/","title":{"rendered":"Get price via ajax"},"content":{"rendered":"<p>Currently I have the below code but how can I make it get the <code>variation<\/code>,<code>sale price<\/code> or like it is now the normal price when a variation is selected? <\/p>\n<p><strong>Code: <\/strong><\/p>\n<pre><code>\n    &lt;div class=&quot;row&quot;&gt;\n    &lt;div class=&quot;col-md-14&quot; style=&quot;margin-top:50px;&quot;&gt;\n    &lt;?php if($product-&gt;is_on_sale())\n    \t\t{\n    \t\t\t$price = $product-&gt;get_sale_price();\n    \t\t}else{\n    \t\t\t$price = $product-&gt;get_price();\n    \t}\n    \n    ?&gt;\n    &lt;script async src=&quot;in=50&amp;max=400&amp;amount=&lt;?php echo $price; ?&gt;&quot; type=&quot;application\/javascript&quot;&gt;&lt;\/script&gt;\n    &lt;\/div&gt;\n    &lt;\/div&gt;\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-9289657","topic","type-topic","status-publish","hentry","topic-tag-ajax"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9289657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9289657\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9289657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}