Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wooexperte/59613761badefec43e33ce25afbfb6db to your computer and use it in GitHub Desktop.
Save wooexperte/59613761badefec43e33ce25afbfb6db to your computer and use it in GitHub Desktop.
Anzahl der verkauften Produkte in der WooCommerce Produktbeschreibung
/*
* Anzahl der verkauften Produkte in der WooCommerce Produktbeschreibung
* https://wooexperte.de/snippet/verkaufte-produkte-woocommerce-produktbeschreibung/
*/
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); // Zahl bestimmt die Position
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Verkaufte Produkte: %s', 'woocommerce' ), $units_sold ) . '</p>'; // Text anpassen
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment