Remove Price from Addon Display

Add “gspc-remove-price” to your field’s CSS Class Name setting and this snippet will automatically remove the price from the product’s description in the cart.

This snippet expects the “Item Meta Display” feed setting to be “Default.”

Default description: Product – Drop Down: First Choice ($10.00) × 2

Price removed: Product – Drop Down: First Choice × 2

Code

Filename: gspc-remove-price-from-addon-display.php

<?php
/**
 * Gravity Shop // GS Product Configurator // Remove Price from Addon Display
 * https://gravitywiz.com/documentation/gravity-shop-product-configurator/
 *
 * Add "gspc-remove-price" to your field's CSS Class Name setting and this snippet will automatically remove the
 * price from the product's description in the cart.
 *
 * This snippet expects the "Item Meta Display" feed setting to be "Default."
 *
 * Default description:
 * Product - Drop Down:
 * First Choice ($10.00) × 2
 *
 * Price removed:
 * Product - Drop Down:
 * First Choice × 2
 */
add_filter( 'gspc_show_addon_price', function( $show, $product_field ) {
	if ( strpos( $field->cssClass, 'gspc-remove-price' ) !== false ) {
		return false;
	}

	return $show;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.