[customer_units]

Displays the number of WooCommerce products purchased by the current logged in user

SIP Social Proof

Shortcode: [customer_units]

Variables accepted:

  • singular: word to use when output is 1. Example singular="time".
  • plural: word to use when output higher than 1. Example plural="times".
  • animation: animate the stats counter. Default is animation="false".
  • multiplier: Multiply the output by any number. Example multiplier="3.5"
  • hide_bellow: hide the shortcode output if the shortcode value is smaller than the one specified. Example hide_bellow="10" -> If the original output is bellow 10, then shortcode output is hidden.
  • value_bellow: substitute the shortcode output with a certain number if the shortcode value is smaller than the one specified. Example value_bellow="10,45" -> output “45” if the original value is under “10”.
  • random(X,Y): Choose a random number between X and Y, to be used inside another variable. Example value_bellow="10,random(10,30)" -> If the original output is bellow 10, then substitute with a random number between 10 and 30.

Tip

This shortcode might be useful to show right after the customer makes a purchase, which you can do like this:

  1. Install code snippets: https://wordpress.org/plugins/code-snippets/
  2. Make a snippet, Name it whatever you want, then add this code:

// add text to the thank you page
 
add_action( ‘woocommerce_thankyou’, ‘add_content’, 1 );

function add_content() {
echo ‘<h2 id=”h2thanks”>Thank you for contributing</h2><p id=”pthanks”>Thank you for making this purchase! With your help we have donated <strong>’.do_shortcode( ‘[customer_units singular=”liter” plural=”liters”]’).’.</strong></p>’;
}

Select: Run only in back-end. Then click on “Save and Activate”.

For example, if your store donate 3 litters of water per every product sold, you could have:

You have help donating [customer_units singular="liter" plural="liters" animation="true" multiplier="3"] of clean water to a poor village!

…becomes…

You have help donating 6 liters of clean water to a poor village!