Skip to content

Instantly share code, notes, and snippets.

@trueqap
Created February 11, 2021 14:18
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 trueqap/ecbce4b7ae16950391b348a08fd7a11a to your computer and use it in GitHub Desktop.
Save trueqap/ecbce4b7ae16950391b348a08fd7a11a to your computer and use it in GitHub Desktop.
Show Total number of sales
<?php
add_action( 'woocommerce_single_product_summary', 'show_total_number_of_sales', 11 );
function show_total_number_of_sales() {
global $product;
$units_sold = $product->get_total_sales();
if ( $units_sold ) echo '<p>' . sprintf( __( 'Összes eladás: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment