I'm using Commerce Webform to add products (camps) to a shopping cart. I want the product price to appear in the shopping cart, but not on the webform. Is there a way to hide the price on the webform? [see screenshot for the display showing the prices that I want to hide]. Thanks in advance for any help!

Comments

Debra G’s picture

Priority: Normal » Major
Issue tags: +Commerce Webform, +Commerce Customizable Products

Being more specific: What I'm trying to do is customize the display of a product displayed on a form using the Commerce Webform Module so that a custom-price-field, made with Commerce Customizable Products, displays instead of the product-price. Anyone? Thanks.

johnennew’s picture

Category: Feature request » Support request
Priority: Major » Minor

Each item is displayed using a standard Drupal theme function, theme_commerce_webform_product_display

As with any theme function, this can be overridden in your site theme's template.php. For example, if your site theme is called mytheme then you should be able to add this function to it's template.php file to hide the price:

/**
 * Theme of the product selection on the webform.
 */
function mytheme_commerce_webform_product_display($variables) {
  $product = $variables['product'];
  return filter_xss($product->title);
}
rpsu’s picture

Are you looking for option in UI to hide all prices or just prices with zero value?

rpsu’s picture

Status: Active » Needs review
StatusFileSize
new2 KB

This patch adds one select element to webform component edit form for productfields allowing user to

  • show all prices (as default)
  • hide all prices
  • hide prices only for zero -priced products
jeremyr’s picture

Patch is working great, however, it's throwing this error for me when I edit the product component:

Notice: Undefined index: hide_price in _webform_edit_productfield() (line 121 of /sites/all/modules/commerce_webform/productfield.inc).
johnennew’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch @rpsu - this is a nice UX addition

I've fixed the bugs in the code and the code which was generating notices and committed into 7.x-2.x branch

  • ceng committed b9c58a8 on 7.x-2.x authored by rpsu
    Issue #2448763 by rpsu, Debra G, ceng, jeremyr: Hide Price of Product on...
johnennew’s picture

Status: Reviewed & tested by the community » Fixed

Committed with thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.