Remove Quantity from Addon Display

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

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

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

Quantity removed: Product – Drop Down: First Choice ($10.00)

Code

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

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