I'm using Woocommerce + the Woocommerce Gravity forms add-on on my website. My issue is that when a customer fills out the product form (on the product page), and then gets to his basket to proceed to the checkout, there is a price info that shows on both pages that I don't want there.
To be more precise : the website sells packaged trips. For one trip, you have to choose from different options including the type of hotel (hostel/2*/3*/4*). The price of the package is XX corresponding to the cheapest option (hostel). Then if the customer chooses a 2* hotel for example, the price of the package goes up 100€. But I don't want the 100€ (which is the option's value) to show on the basket / checkout page. I only want his choice (2*) to show so that I know what he chose.
here is a picture showing what I mean : http://tinypic.com/r/2v3llxx/9
and here is a link to the corresponding product page (but you'll obviously have to fake a purchase if you want to access the basket/checkout pages): http://tinyurl.com/pzum42k
Any help would be great !!
Thanks in advance G
Option 1 - Modify the woocommerce templates to change the output.
The item variation data is outputted from woocommerce/templates/cart/cart-item-data.php
in a foreach
loop. You could check for the key and do a string manipulation to remove the part you don't want to output.
preg_replace("/\([^)]+\)/","",$string);
Option 2 - Use javascript to remove part of the output
The elements have a class (eg. variation-Votrehbergement
) that you could use to grab the contents and do a string manipulation to remove the part you don't want to output.
jQuery(document).ready(function () {
$( ".variation-Votrehbergement p, .variation-Chambre1 p").each(function( index,elem ) {
$(elem).html($(elem).html().replace(/ *\([^)]*\) */g, ""));
});
});