Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AnanthFlycart/2966499a12abc97c17d232a357ef4df8 to your computer and use it in GitHub Desktop.

Select an option

Save AnanthFlycart/2966499a12abc97c17d232a357ef4df8 to your computer and use it in GitHub Desktop.
CUW: Offer hidden quantity
add_filter('woocommerce_cart_item_quantity', function ($product_quantity, $cart_item_key, $cart_item) {
if (isset($cart_item['cuw_offer'])) {
return '<input type="hidden" class="qty" name="cart[' . esc_attr($cart_item_key) . '][qty]" value="' . esc_attr($cart_item['quantity']) . '">';
}
return $product_quantity;
}, 100000, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment