Skip Navigation

[Resolved] [add_to_cart id=" [wpv-post-id] "] Trying to separate Prices and Add To Cart

This support ticket is created 10 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Manila (GMT+08:00)


This topic contains 6 replies, has 2 voices.

Last updated by Jive 10 years, 1 month ago.

Assigned support staff: emerson.


When I use this code:
[add_to_cart id=" [wpv-post-id] "]

I get something similar to this:
$50 $40 Add to cart

Or for a variable product I get this:
From: $25 Select options

In the above examples, I'm wondering if I can have the price eg. "$50 $40" and "From: $25" show at one spot in my html, then somewhere else have the "Add to cart" and "Select options".

Can I do something like this to show only the "Add to cart" button?:
[add_to_cart id=" [wpv-post-id] " showprice="no"]

Then somewhere else in my View do this to show only the price?:
[add_to_cart id=" [wpv-post-id] " showaddtocart="no"]

It's a shot in the dark, but i'm hoping to fully customize my View by separating these to things.

I tried to just use [wpv-post-field name="_price"] but it doesn't show the sale price or the "From:" when it's a variable product.

I can't find any documentation on the the issues I'm facing.

Thanks in advance!


Hi Jive,
If you only like to show the "Add to cart" button and without the price, you can replace the shortcode:

[add_to_cart id="[wpv-post-id]"]

With this:


All of these are edited within your View Edit Meta HTML section.
And if you only like to show the product price of the item without the Add to cart button, you can use this shortcode:

$[wpv-post-field name="_regular_price"][wpv-post-field name="_sale_price"]

That will show the product price in dollars (see the $ sign prefix before the shortcode). You can replace it with your preferred currency.

If you want to read some detailed documentation on this feature, you can read it here:

Thanks and Happy New Year!



Thanks Emerson. A few issues I'm having here:

1. Using this - $[wpv-post-field name="_regular_price"][wpv-post-field name="_sale_price"]
a. I lose the "From:" when it's a variable product.
b. I lose the strikethrough on the sale price when a product is on sale
c. I lose the price altogether when it's a variable product

2. No matter which way I show the "Add to cart" button, the a:link only links at the very bottom of the text. Even if I add padding, or make the line-height bigger, it only links the bottom half. Very strange.
a. The same thing is happening for my custom taxonomy "Product Categories". When these are displayed the link is not on the entire text, it's only at the very bottom of the category name.

Though I keep changing it around, you can check it out here: http:// woo.thestiz .com/shop/
(SEO is important so i don't want live links going around for the test site- sorry that's annoying).

I'll leave the product archives like this till I hear back from someone.


Hi Jive,
For your first issue, variable product prices are stored as custom fields in the post meta table of your database. The following are meta key names that you can use to get it's values. If you have access to your database, you can search this in your meta table.


To retrieve the prices and use them in your template, you will either be using Types or WordPress API. You can read this tutorial for details:

wpv-post-field name is just one of the ways in retrieving the product price values. There are others.

Since you have a combination of variation and simple products, you can use conditional views: to output appropriate shortcodes for your respective products.

For your second issue, I am a bit confused since the page you have given to me is looking great. But the add to cart button is not yet linked. Can you try implementing the actual shortcode so that we could see what is really the problem?




Okay, thanks. I'm new to variables so it'll take some playing around, but that makes sense. Basically, if variable show this code, if anything else show other code.

For the second issue, i'm confused. The add to cart buttons are already linked. That's the problem, you just have to hover over only the bottom of the button to get it to work. Same thing with the category names. They look like they aren't linked, but when you hover over just the bottom of the text very slowly, you can get the link to work. Strange behavior.

Here is my current code for this View, same as it was before my last email.

<!-- wpv-loop-start -->
<li class="product"><h3>[wpv-post-link]</h3><span class="price">$[wpv-post-field name="_regular_price"][wpv-post-field name="_sale_price"]</span>[wp_media media="audio" volume=0.8 urls="[types field="file"][/types]"]
<p class="product-meta"><i class="icon-folder-close"></i> [wpv-post-taxonomy type="product_cat" separator=", " format="link" show="name"]<br /><i class="icon-headphones"></i> [wpv-post-taxonomy type="producers" separator=", " format="link" show="name"]</p>
<div class="clear"></div></li>
<!-- wpv-loop-end -->
[wpv-no-posts-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-posts-found]

Hi Jive,
Thanks for the update. I look again your page and it seems you have browser incompatibility issues. For example, try visiting this page: http:// woo.thestiz .com/shop/ in the Firefox browser (latest version) and the Add to cart button link is not clickable.
Then visit again that same page on the Chrome browser and you will see that the add to cart button link is working as well. Based on your source code you are using [wpv-wooaddcart] shortcode, I have used this on my test site but its working in Firefox.

So I suspect something is conflicting with your add to cart button, probably JS or CSS related. This is my suggestion:

1.) Try moving all JS scripts on the <head> section of your page.
2.) Eliminate redundant or repeating scripts (for example if you are loading Jquery library twice or you have lots of JS library that you are not using).
3.) Make sure the hyperlink is complete, for example the href attribute should include http of the URL. You can as well use image link for the Add to cart button and check it with several browsers to see if it is working.
4.) Try tweaking the JS and CSS styles you have implemented on the Add to cart button or remove them entirely to see if it works without any JS and styling at all.

It looks like this is the only problem in your page. The rest are working correctly. I tried clicking the Add to cart button in Chrome browser and it will take me correctly to your shopping cart page with the correct products.



Ahh, you are correct. I didn't even think to try other browsers, i've been dealing with Chrome. I found out it's the audio player plugin causing the conflict. I'm in contact with the plugin dev now... Soon as I removed the jQuery/js from the plugin, all the links worked correctly. Of course, the audio wouldn't play either though so hopefully I can figure it out.

Thanks Emerson!