Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active September 24, 2025 14:38
Show Gist options
  • Select an option

  • Save plugin-republic/3fd8196a9045e2c8de039decf8618a36 to your computer and use it in GitHub Desktop.

Select an option

Save plugin-republic/3fd8196a9045e2c8de039decf8618a36 to your computer and use it in GitHub Desktop.
<?php
/**
* Remove quantity field from single product pages for specific products
* Update list of product IDs
*/
function pr_is_sold_individually_product_list( $individually, $product ) {
if( in_array( $product->getid(), array( 1234, 5678 ) ) ) { // Update the IDs in this list
$individually = true;
}
return $individually;
}
add_filter( 'woocommerce_is_sold_individually', 'pr_is_sold_individually_product_list', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment